public class Mother extends java.lang.Object implements RandomNumber
Cycle length is 3 x 1047
| Modifier and Type | Field and Description |
|---|---|
static long |
BITMASK |
static double |
MULTIPLIER |
private long |
originalResult |
private long[] |
originalX |
private long |
result |
private long[] |
x |
| Constructor and Description |
|---|
Mother()
Creates a new instance of Mother with default seeds.
|
| Modifier and Type | Method and Description |
|---|---|
double |
draw()
Generates the next U(0,1)
|
long |
drawLong()
Generates the next number.
|
double |
getMultiplier()
Returns the multiplier used to convert the random number to a U(0,1).
|
long |
getSeed()
Returns the current seed.
|
long[] |
getSeeds()
Returns an array containing the 5 seeds of the generator.
|
static void |
main(java.lang.String[] args)
Tests the random generator.
|
void |
resetSeed()
Resets seed to last setSeed() value
|
void |
setSeed(long seed)
Not used since this generator requires 5 seeds (use setSeeds(long[]))
|
void |
setSeeds(long[] seed)
Sets this generators seeds to the 5 seeds in the given array.
|
java.lang.String |
toString()
Returns "Mother of All Generators"
|
public static final long BITMASK
public static final double MULTIPLIER
private long[] originalX
private long originalResult
private long result
private long[] x
public long drawLong()
drawLong in interface RandomNumberpublic double draw()
draw in interface RandomNumberpublic long getSeed()
getSeed in interface RandomNumberpublic long[] getSeeds()
getSeeds in interface RandomNumberpublic void resetSeed()
resetSeed in interface RandomNumberpublic void setSeed(long seed)
setSeed in interface RandomNumberseed - The new random number seedjava.lang.IllegalArgumentException - In all cases.public void setSeeds(long[] seed)
setSeeds in interface RandomNumberseed - An array with at least 5 elements. The elements should be unique
and non-zero.java.lang.IllegalArgumentException - If the array does not have at least 5 elements.public java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
args - the command line argumentspublic double getMultiplier()
getMultiplier in interface RandomNumber