public class MRG extends java.lang.Object implements LinearCongruentialGenerator
xi = (a1 * xi-1 + a2 * xi-2 + ... + ak * xi-k) mod m ui = xi / m
| Constructor and Description |
|---|
MRG(long m,
long... a)
Construct a Multiple Recursive Generator.
|
| Modifier and Type | Method and Description |
|---|---|
long |
modulus()
Get the modulus of this linear congruential generator.
|
double |
nextDouble()
Get the next random
double. |
long |
nextLong()
Get the next random
long. |
int |
order()
Get the order of recursion.
|
void |
seed(long... x)
Seed the random number generator to produce repeatable sequences.
|
public MRG(long m,
long... a)
m - the modulusa - multipliers for the Lehmer rng (a long)public void seed(long... x)
RandomNumberGeneratorseed in interface RandomNumberGeneratorx - the seedspublic int order()
LinearCongruentialGeneratororder in interface LinearCongruentialGeneratorpublic long modulus()
LinearCongruentialGeneratormodulus in interface LinearCongruentialGeneratorpublic long nextLong()
RandomLongGeneratorlong.nextLong in interface RandomLongGeneratorlongpublic double nextDouble()
RandomNumberGeneratordouble.nextDouble in interface RandomNumberGenerator