Class MRG
- java.lang.Object
-
- dev.nm.stat.random.rng.univariate.uniform.linear.MRG
-
- All Implemented Interfaces:
RandomLongGenerator
,RandomNumberGenerator
,LinearCongruentialGenerator
,Seedable
public class MRG extends Object implements LinearCongruentialGenerator
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 Constructor Description MRG(long m, long... a)
Construct a Multiple Recursive Generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
modulus()
Get the modulus of this linear congruential generator.double
nextDouble()
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.
-
-
-
Method Detail
-
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
-
-