Package jdistlib.rng
Class RandomCMWC
java.lang.Object
java.util.Random
jdistlib.rng.RandomEngine
jdistlib.rng.RandomCMWC
- All Implemented Interfaces:
Serializable,RandomGenerator
Implementation of CMWC4096 (Complementary-multiply-with-carry) random number generator by George Marsaglia. The period is approximately 2^131086.
Paper: Marsaglia, George. 2003. Random number generators. Journal of Modern Applied Statistical Methods, 2(1): 2-13. (link)
The 64-bit seed is expanded into the full 4096-word state using SplitMix64. The initial carry is 362436. Corrected unsigned arithmetic changes streams from older releases; serialized states from the broken implementation are rejected.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.random.RandomGenerator
RandomGenerator.ArbitrarilyJumpableGenerator, RandomGenerator.JumpableGenerator, RandomGenerator.LeapableGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator -
Field Summary
Fields inherited from class jdistlib.rng.RandomEngine
mSeed -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.Random
doubles, doubles, doubles, doubles, from, ints, ints, ints, ints, longs, longs, longs, longs, nextBoolean, nextBytesMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.random.RandomGenerator
isDeprecated, nextDouble, nextDouble, nextExponential, nextFloat, nextFloat, nextGaussian, nextInt, nextLong
-
Constructor Details
-
RandomCMWC
public RandomCMWC() -
RandomCMWC
public RandomCMWC(long seed)
-
-
Method Details
-
setSeed
public void setSeed(long seed) - Overrides:
setSeedin classRandomEngine
-
nextInt
public int nextInt()- Specified by:
nextIntin interfaceRandomGenerator- Specified by:
nextIntin classRandomEngine
-
nextLong
public long nextLong()- Specified by:
nextLongin interfaceRandomGenerator- Specified by:
nextLongin classRandomEngine
-
nextDouble
public double nextDouble()- Specified by:
nextDoublein interfaceRandomGenerator- Specified by:
nextDoublein classRandomEngine
-
nextFloat
public float nextFloat()- Specified by:
nextFloatin interfaceRandomGenerator- Specified by:
nextFloatin classRandomEngine
-
nextGaussian
public double nextGaussian()- Specified by:
nextGaussianin interfaceRandomGenerator- Specified by:
nextGaussianin classRandomEngine
-
clone
- Specified by:
clonein classRandomEngine
-