Class CompositeLinearCongruentialGenerator
- java.lang.Object
-
- dev.nm.stat.random.rng.univariate.uniform.linear.CompositeLinearCongruentialGenerator
-
- All Implemented Interfaces:
RandomLongGenerator,RandomNumberGenerator,LinearCongruentialGenerator,Seedable
public class CompositeLinearCongruentialGenerator extends Object implements LinearCongruentialGenerator
A composite generator combines a number of simpleLinearCongruentialGenerator, such asLehmer, 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 Summary
Constructors Constructor Description CompositeLinearCongruentialGenerator(LinearCongruentialGenerator[] rng)Constructs a linear congruential generator from some simpler and shorter modulus generators.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longmodulus()Get the modulus of this linear congruential generator.doublenextDouble()Get the next randomdouble.longnextLong()Get the next randomlong.intorder()Get the order of recursion.voidseed(long... seeds)Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Constructor Detail
-
CompositeLinearCongruentialGenerator
public CompositeLinearCongruentialGenerator(LinearCongruentialGenerator[] rng)
Constructs a linear congruential generator from some simpler and shorter modulus generators.- Parameters:
rng- simpler and shorter modulus linear congruential generators
-
-
Method Detail
-
seed
public void seed(long... seeds)
Description copied from interface:SeedableSeed the random number/vector/scenario generator to produce repeatable experiments.
-
order
public int order()
Description copied from interface:LinearCongruentialGeneratorGet the order of recursion.- Specified by:
orderin interfaceLinearCongruentialGenerator- Returns:
- the order of recursion
-
modulus
public long modulus()
Description copied from interface:LinearCongruentialGeneratorGet the modulus of this linear congruential generator.- Specified by:
modulusin interfaceLinearCongruentialGenerator- Returns:
- the modulus
-
nextLong
public long nextLong()
Description copied from interface:RandomLongGeneratorGet the next randomlong.- Specified by:
nextLongin interfaceRandomLongGenerator- Returns:
- the next random
long
-
nextDouble
public double nextDouble()
Description copied from interface:RandomNumberGeneratorGet the next randomdouble.- Specified by:
nextDoublein interfaceRandomNumberGenerator- Returns:
- the next random number
-
-