- All Implemented Interfaces:
- java.io.Serializable
public class XORShiftRandom
extends java.util.Random
This class implements a XORShift random number generator algorithm
Source:
Marsaglia, G. (2003). Xorshift RNGs. Journal of Statistical Software, Vol. 8, Issue 14.
- See Also:
- Paper
This implementation is approximately 3.5 times faster than
{@link java.util.Random java.util.Random}, partly because of the algorithm, but also due
to renouncing thread safety. JDK's implementation uses an AtomicLong seed, this class
uses a regular Long. We can forgo thread safety since we use a new instance of the RNG
for each thread.,
Serialized Form