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)
Seedable
public int order()
LinearCongruentialGenerator
order
in interface LinearCongruentialGenerator
public long modulus()
LinearCongruentialGenerator
modulus
in interface LinearCongruentialGenerator
public long nextLong()
RandomLongGenerator
long
.nextLong
in interface RandomLongGenerator
long
public double nextDouble()
RandomNumberGenerator
double
.nextDouble
in interface RandomNumberGenerator
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.