Class MRG
java.lang.Object
dev.nm.stat.random.rng.univariate.uniform.linear.MRG
- All Implemented Interfaces:
RandomLongGenerator
,RandomNumberGenerator
,LinearCongruentialGenerator
,Seedable
A Multiple Recursive Generator (MRG) is a linear congruential generator which takes this form:
xi = (a1 * xi-1 + a2 * xi-2 + ... + ak * xi-k) mod m ui = xi / m
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
modulus()
Get the modulus of this linear congruential generator.double
Get the next randomdouble
.long
nextLong()
Get the next randomlong
.int
order()
Get the order of recursion.void
seed
(long... x) Seed the random number/vector/scenario generator to produce repeatable experiments.
-
Constructor Details
-
MRG
public MRG(long m, long... a) Construct a Multiple Recursive Generator.- Parameters:
m
- the modulusa
- multipliers for the Lehmer rng (along
)
-
-
Method Details
-
seed
public void seed(long... x) Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments. -
order
public int order()Description copied from interface:LinearCongruentialGenerator
Get the order of recursion.- Specified by:
order
in interfaceLinearCongruentialGenerator
- Returns:
- the order of recursion
-
modulus
public long modulus()Description copied from interface:LinearCongruentialGenerator
Get the modulus of this linear congruential generator.- Specified by:
modulus
in interfaceLinearCongruentialGenerator
- Returns:
- the modulus
-
nextLong
public long nextLong()Description copied from interface:RandomLongGenerator
Get the next randomlong
.- Specified by:
nextLong
in interfaceRandomLongGenerator
- Returns:
- the next random
long
-
nextDouble
public double nextDouble()Description copied from interface:RandomNumberGenerator
Get the next randomdouble
.- Specified by:
nextDouble
in interfaceRandomNumberGenerator
- Returns:
- the next random number
-