dcapwell commented on code in PR #103:
URL: https://github.com/apache/cassandra-accord/pull/103#discussion_r1674892359


##########
accord-core/src/test/java/accord/utils/Property.java:
##########
@@ -29,17 +27,32 @@
 import java.util.List;
 import java.util.Objects;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.function.Consumer;
 import java.util.stream.Collectors;
 import javax.annotation.Nullable;
 
 public class Property
 {
+    private static final AtomicLong seedUniquifier = new 
AtomicLong(8682522807148012L);
+
+    private static long seedUniquifier()
+    {
+        // L'Ecuyer, "Tables of Linear Congruential Generators of
+        // Different Sizes and Good Lattice Structure", 1999
+        for (; ; )
+        {
+            long current = seedUniquifier.get();
+            long next = current * 1181783497276652981L;
+            if (seedUniquifier.compareAndSet(current, next))
+                return next;
+        }
+    }
+
     public static abstract class Common<T extends Common<T>>
     {
-        protected long seed = ThreadLocalRandom.current().nextLong();

Review Comment:
   this is a bug... This tends to produce the same seed over and over when you 
restart the JVM... this would mean we would run with the same seed every time!  
Rather than do that, the new logic uses `java.util.Random`'s seed logic



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to