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)
Weakness: The quality is dependent upon the choice of seed. Some seed actually may weaken the algorithm significantly. A known good seed is 362436. Marsaglia suggested that any seed less than 809430660 is fine, but many detractors criticize that it is not necessarily so.
- 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 jdistlib.rng.RandomEngine
getSeed, random, setSeedMethods inherited from class java.util.Random
doubles, doubles, doubles, doubles, from, ints, ints, ints, ints, longs, longs, longs, longs, next, 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()
-
-
Method Details
-
nextInt
public final int nextInt()- Specified by:
nextIntin interfaceRandomGenerator- Specified by:
nextIntin classRandomEngine
-
nextInt
public final int nextInt(int n) - Specified by:
nextIntin interfaceRandomGenerator- Specified by:
nextIntin classRandomEngine
-
nextLong
public final long nextLong()- Specified by:
nextLongin interfaceRandomGenerator- Specified by:
nextLongin classRandomEngine
-
nextLong
public final long nextLong(long n) - Specified by:
nextLongin interfaceRandomGenerator- Specified by:
nextLongin classRandomEngine
-
nextGaussian
public final double nextGaussian()- Specified by:
nextGaussianin interfaceRandomGenerator- Specified by:
nextGaussianin 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
-
clone
- Specified by:
clonein classRandomEngine
-