The constructor of the java.util.Random class, which creates a new random number generator using a single {@code long} seed, doesn't calls setSeed(seed) method more.
In brief, spec should be clarified here. Actual spec says that Random(seed) is equivalent to
Random rnd = new Random();
rnd.setSeed(seed);
But current implementation does the same as the code above, but does not call rnd.setSeed(seed). It is not obvious at all - does it still "equivalent" or not that clearly demonstrated by corresponding JCK test.
More precise the Random(seed) is not equivalent to
Random rnd = new Random();
rnd.setSeed(seed);
As described in the my comments the haveNextNextGaussian variable will not be cleaned if the instance of Random created with Random(seed) constructor.
In brief, spec should be clarified here. Actual spec says that Random(seed) is equivalent to
Random rnd = new Random();
rnd.setSeed(seed);
But current implementation does the same as the code above, but does not call rnd.setSeed(seed). It is not obvious at all - does it still "equivalent" or not that clearly demonstrated by corresponding JCK test.
More precise the Random(seed) is not equivalent to
Random rnd = new Random();
rnd.setSeed(seed);
As described in the my comments the haveNextNextGaussian variable will not be cleaned if the instance of Random created with Random(seed) constructor.
- relates to
-
JDK-7051516 ThreadLocalRandom seed is never initialized so all instances generate the same sequence
-
- Closed
-
-
JDK-6937857 Concurrent calls to new Random() not random enough
-
- Closed
-