summaryrefslogtreecommitdiff
path: root/src/main/java/utils/VSRandom.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-06 08:02:52 +0300
committerPaul Buetow <paul@buetow.org>2025-06-06 08:02:52 +0300
commit1d99762c7965d351510cfb5e08eac25e48d96038 (patch)
treef469493e911878ab9055ccf0494211bf9015922d /src/main/java/utils/VSRandom.java
parent4d35597bd92607c4d194686e20b125044506c79a (diff)
Modernize project structure, update Maven config, move sources, add logging config, update README and .gitignore
Diffstat (limited to 'src/main/java/utils/VSRandom.java')
-rw-r--r--src/main/java/utils/VSRandom.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/utils/VSRandom.java b/src/main/java/utils/VSRandom.java
new file mode 100644
index 0000000..6c1de90
--- /dev/null
+++ b/src/main/java/utils/VSRandom.java
@@ -0,0 +1,37 @@
+package utils;
+
+import java.util.Random;
+
+/**
+ * The class VSRandom. Some customization of the standard Random class of Java.
+ *
+ * @author Paul C. Buetow
+ */
+public final class VSRandom extends Random {
+ /**
+ * Instantiates a new VSrandom object.
+ *
+ * @param seedAdd the seed to add.
+ */
+ public VSRandom(long seedAdd) {
+ super(seedAdd*System.currentTimeMillis()+seedAdd);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Random#nextInt()
+ */
+ public int nextInt() {
+ return Math.abs(super.nextInt());
+ }
+
+ /**
+ * Next long.
+ *
+ * @param mod the mod
+ *
+ * @return the random long
+ */
+ public long nextLong(long mod) {
+ return Math.abs((super.nextLong() + System.currentTimeMillis()) % mod);
+ }
+}