IRandom
public class RandomMersenneTwister extends java.lang.Object implements IRandom
Other methods added for the Java version.
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
hasNextGaussian |
|
protected static int |
LOWER_MASK |
|
protected static int |
M |
|
protected static int |
MATRIX_A |
|
protected int[] |
mt |
|
protected int |
mti |
|
protected static int |
N |
|
protected double |
nextGaussian |
|
protected int |
savedSeed |
|
protected int[] |
savedSeedArray |
|
protected static int |
UPPER_MASK |
Constructor | Description |
---|---|
RandomMersenneTwister(int s) |
Creates a Mersenne Twister with the given seed.
|
RandomMersenneTwister(int[] s) |
Creates a Mersenne Twister with the given array of seeds.
|
Modifier and Type | Method | Description |
---|---|---|
int |
getSeed() |
|
int[] |
getSeedArray() |
|
double |
nextDouble() |
Returns a pseudorandom double, uniformly distributed between
0.0 (exclusive) and 1.0 (exclusive).
|
double |
nextFixedDouble() |
Returns a pseudorandom double, uniformly distributed between
0.0 (inclusive) and 1.0 (exclusive).
|
float |
nextFloat() |
|
double |
nextGaussian() |
Returns a pseudorandom double, Gaussian ("normally") distributed
value with mean 0.0 and standard deviation 1.0.
|
int |
nextInt() |
|
int |
nextInt(int max) |
Returns a random int ranging from 0 to max-1.
|
long |
nextLong() |
|
void |
setSeed(int s) |
Configures the RNG with the given seed.
|
void |
setSeedArray(int[] init_key) |
Configures the RNG with an array of seeds
|
protected static final int N
protected static final int M
protected static final int MATRIX_A
protected static final int UPPER_MASK
protected static final int LOWER_MASK
protected final int[] mt
protected int mti
protected boolean hasNextGaussian
protected double nextGaussian
protected int[] savedSeedArray
protected int savedSeed
public RandomMersenneTwister(int s)
public RandomMersenneTwister(int[] s)
public int getSeed()
public void setSeed(int s)
public int[] getSeedArray()
public void setSeedArray(int[] init_key)
public int nextInt()
public long nextLong()
public int nextInt(int max)
public double nextFixedDouble()
IRandom
nextFixedDouble
in interface IRandom
public double nextDouble()
IRandom
nextDouble
in interface IRandom
public double nextGaussian()
IRandom
nextGaussian
in interface IRandom
public float nextFloat()