|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectetomica.util.RandomMersenneTwister
public class RandomMersenneTwister
Mersenne Twister RNG. seed initialization and nextInt() methods written in C by Takuji Nishimura and Makoto Matsumoto as described above, and translated into Java. Other methods added for the Java version.
| Field Summary | |
|---|---|
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 static int |
UPPER_MASK
|
| Constructor Summary | |
|---|---|
RandomMersenneTwister(int s)
Creates a Mersenne Twister with the given seed. |
|
RandomMersenneTwister(int[] s)
Creates a Mersenne Twister with the given array of seeds. |
|
| Method Summary | |
|---|---|
double |
nextDouble()
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
public RandomMersenneTwister(int s)
public RandomMersenneTwister(int[] s)
| Method Detail |
|---|
public void setSeed(int s)
public void setSeedArray(int[] init_key)
public int nextInt()
public long nextLong()
public int nextInt(int max)
nextInt in interface IRandompublic double nextDouble()
IRandom
nextDouble in interface IRandompublic double nextGaussian()
IRandom
nextGaussian in interface IRandompublic float nextFloat()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||