public class CompositeLinearCongruentialGenerator extends Object implements LinearCongruentialGenerator
LinearCongruentialGenerator, such as Lehmer,
to form one longer period generator by first summing values and then taking modulus.
The resultant generator in general has a superior uniformity and a longer period,
without overflowing the arithmetics.| Constructor and Description |
|---|
CompositeLinearCongruentialGenerator(LinearCongruentialGenerator[] rng)
Construct a linear congruential generator from some simpler and shorter modulus generators.
|
| 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... seeds)
Seed the random number/vector/scenario generator to produce repeatable experiments.
|
public CompositeLinearCongruentialGenerator(LinearCongruentialGenerator[] rng)
rng - simpler and shorter modulus linear congruential generatorspublic void seed(long... seeds)
Seedablepublic 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 RandomNumberGeneratorCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.