Package org.apache.commons.math3.random
Class Well44497b
- java.lang.Object
-
- org.apache.commons.math3.random.BitsStreamGenerator
-
- org.apache.commons.math3.random.AbstractWell
-
- org.apache.commons.math3.random.Well44497b
-
- All Implemented Interfaces:
java.io.Serializable
,RandomGenerator
public class Well44497b extends AbstractWell
This class implements the WELL44497b pseudo-random number generator from François Panneton, Pierre L'Ecuyer and Makoto Matsumoto.This generator is described in a paper by François Panneton, Pierre L'Ecuyer and Makoto Matsumoto Improved Long-Period Generators Based on Linear Recurrences Modulo 2 ACM Transactions on Mathematical Software, 32, 1 (2006). The errata for the paper are in wellrng-errata.txt.
- Since:
- 2.2
- See Also:
- WELL Random number generator, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static int
K
Number of bits in the pool.private static int
M1
First parameter of the algorithm.private static int
M2
Second parameter of the algorithm.private static int
M3
Third parameter of the algorithm.private static long
serialVersionUID
Serializable version identifier.
-
Constructor Summary
Constructors Constructor Description Well44497b()
Creates a new random number generator.Well44497b(int seed)
Creates a new random number generator using a single int seed.Well44497b(int[] seed)
Creates a new random number generator using an int array seed.Well44497b(long seed)
Creates a new random number generator using a single long seed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
next(int bits)
Generate next pseudorandom number.-
Methods inherited from class org.apache.commons.math3.random.AbstractWell
setSeed, setSeed, setSeed
-
Methods inherited from class org.apache.commons.math3.random.BitsStreamGenerator
clear, nextBoolean, nextBytes, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, nextLong
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serializable version identifier.- See Also:
- Constant Field Values
-
K
private static final int K
Number of bits in the pool.- See Also:
- Constant Field Values
-
M1
private static final int M1
First parameter of the algorithm.- See Also:
- Constant Field Values
-
M2
private static final int M2
Second parameter of the algorithm.- See Also:
- Constant Field Values
-
M3
private static final int M3
Third parameter of the algorithm.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Well44497b
public Well44497b()
Creates a new random number generator.The instance is initialized using the current time as the seed.
-
Well44497b
public Well44497b(int seed)
Creates a new random number generator using a single int seed.- Parameters:
seed
- the initial seed (32 bits integer)
-
Well44497b
public Well44497b(int[] seed)
Creates a new random number generator using an int array seed.- Parameters:
seed
- the initial seed (32 bits integers array), if null the seed of the generator will be related to the current time
-
Well44497b
public Well44497b(long seed)
Creates a new random number generator using a single long seed.- Parameters:
seed
- the initial seed (64 bits integer)
-
-
Method Detail
-
next
protected int next(int bits)
Generate next pseudorandom number.This method is the core generation algorithm. It is used by all the public generation methods for the various primitive types
BitsStreamGenerator.nextBoolean()
,BitsStreamGenerator.nextBytes(byte[])
,BitsStreamGenerator.nextDouble()
,BitsStreamGenerator.nextFloat()
,BitsStreamGenerator.nextGaussian()
,BitsStreamGenerator.nextInt()
,BitsStreamGenerator.next(int)
andBitsStreamGenerator.nextLong()
.- Specified by:
next
in classAbstractWell
- Parameters:
bits
- number of random bits to produce- Returns:
- random bits generated
-
-