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 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... x)Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Method Detail
-
seed
public void seed(long... x)
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
-
-