|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.stats.random.pseudorandom.linear.MRG
public class MRG
A Multiple Recursive Generator is a linear congruential generator which takes this form:
xi = (a1 * xi-1 + a2 * xi-2 + ... + ak * xi-k) mod m
ui = xi / m
| Field Summary | |
|---|---|
long |
m
the modulus |
| Constructor Summary | |
|---|---|
MRG(long m,
long... a)
Construct a Multiple Recursive Generator. |
|
| Method Summary | |
|---|---|
long |
modulus()
Get the modulus of this linear congruential generator. |
double |
nextDouble()
Get the next random double between 0 and 1. |
long |
nextLong()
Get the next random long. |
int |
order()
Get the order of recursion. |
void |
seed(long... x)
This function must be called at least once before call nextLong() to seed the generator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final long m
| Constructor Detail |
|---|
public MRG(long m,
long... a)
m - the modulusa - multipliers for the Lehmer rng (a long)| Method Detail |
|---|
public void seed(long... x)
nextLong() to seed the generator.
seed in interface RandomNumberGeneratorx - the seedspublic int order()
LinearCongruentialGenerator
order in interface LinearCongruentialGeneratorpublic long modulus()
LinearCongruentialGenerator
modulus in interface LinearCongruentialGeneratormpublic long nextLong()
RandomLongGeneratorlong.
nextLong in interface RandomLongGeneratorlongpublic double nextDouble()
nextDouble in interface RandomNumberGenerator
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||