smile.math.random
Class MersenneTwister64
- java.lang.Object
-
- smile.math.random.MersenneTwister64
-
- All Implemented Interfaces:
- RandomNumberGenerator
public class MersenneTwister64 extends java.lang.Object implements RandomNumberGenerator
Mersenne Twister 64-bit.Similar to the regular Mersenne Twister but is implemented use 64-bit registers (Java
long) and produces different output.- Makato Matsumoto and Takuji Nishimura, "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3--30.
-
-
Constructor Summary
Constructors Constructor and Description MersenneTwister64()Constructor.MersenneTwister64(long seed)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intnext(int numbits)Returns up to 32 random bits.doublenextDouble()Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.voidnextDoubles(double[] d)Returns a vector of pseudorandom, uniformly distributed double values between 0.0 and 1.0 from this random number generator's sequence.intnextInt()Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.intnextInt(int n)Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.longnextLong()Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.voidsetSeed(long seed)Initialize the random generator with a seed.
-
-
-
Constructor Detail
-
MersenneTwister64
public MersenneTwister64()
Constructor.
-
MersenneTwister64
public MersenneTwister64(long seed)
Constructor.- Parameters:
seed-
-
-
Method Detail
-
setSeed
public void setSeed(long seed)
Description copied from interface:RandomNumberGeneratorInitialize the random generator with a seed.- Specified by:
setSeedin interfaceRandomNumberGenerator
-
next
public int next(int numbits)
Description copied from interface:RandomNumberGeneratorReturns up to 32 random bits.- Specified by:
nextin interfaceRandomNumberGenerator
-
nextDouble
public double nextDouble()
Description copied from interface:RandomNumberGeneratorReturns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.- Specified by:
nextDoublein interfaceRandomNumberGenerator
-
nextDoubles
public void nextDoubles(double[] d)
Description copied from interface:RandomNumberGeneratorReturns a vector of pseudorandom, uniformly distributed double values between 0.0 and 1.0 from this random number generator's sequence.- Specified by:
nextDoublesin interfaceRandomNumberGenerator
-
nextInt
public int nextInt()
Description copied from interface:RandomNumberGeneratorReturns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.- Specified by:
nextIntin interfaceRandomNumberGenerator
-
nextInt
public int nextInt(int n)
Description copied from interface:RandomNumberGeneratorReturns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.- Specified by:
nextIntin interfaceRandomNumberGenerator
-
nextLong
public long nextLong()
Description copied from interface:RandomNumberGeneratorReturns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.- Specified by:
nextLongin interfaceRandomNumberGenerator
-
-
DataMelt 3.0 © DataMelt by jWork.ORG