Class ThreadLocalMersenneTwister

java.lang.Object
java.util.Random
org.moeaframework.parallel.util.ThreadLocalMersenneTwister
All Implemented Interfaces:
Serializable, RandomGenerator

public class ThreadLocalMersenneTwister extends Random
A thread-safe version of the MersenneTwister random number generator (RNG). Each thread is assigned a unique instance of the RNG with its own seed. To use:
   PRNG.setRandom(ThreadLocalMersenneTwister.getInstance());
 
Note: Java also has the that can provide similar access to random numbers across threads. The Mersenne Twister, however, has better characteristics (extremely long period, high equidistribution, etc.).
See Also: