Package edu.cornell.lassp.houle.RngPack
Class Ranmar
- java.lang.Object
-
- edu.cornell.lassp.houle.RngPack.RandomElement
-
- edu.cornell.lassp.houle.RngPack.RandomSeedable
-
- edu.cornell.lassp.houle.RngPack.Ranmar
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class Ranmar extends RandomSeedable implements Serializable
RANMAR is a lagged Fibonacci generator proposed by Marsaglia and Zaman and is a good research grade generator. This version of RANMAR is based on the paper by James, which is a good reference for the properties of RANMAR and several other generators.
REFERENCES:
F. James, Comp. Phys. Comm. 60 (1990) p 329-344
and was originally described in
G. Marsaglia, A. Zaman and W.-W Tsang, Stat. Prob. Lett 9 (1990) p 35.Source code is available.
- Version:
- 1.1a
- Author:
- Paul Houle (E-mail: [email protected])
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Ranmar()
Initialize Ranmar with a default seed taken from Marsaglia and Zaman's paper.Ranmar(int ijkl)
Initialize Ranmar with a specified integer seedRanmar(long ijkl)
Initialize Ranmar with a specified long seedRanmar(Date d)
Seed RANMAR from the clock.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
raw()
The generatorvoid
raw(double[] d, int n)
A version of the generator for filling arrays, inlined for speed-
Methods inherited from class edu.cornell.lassp.houle.RngPack.RandomSeedable
ClockSeed, ClockSeed
-
-
-
-
Field Detail
-
DEFSEED
public static int DEFSEED
Default seed.DEFSEED=54217137
-
BIG_PRIME
public static int BIG_PRIME
The 46,009,220nd prime number, he largest prime less than 9*108. Used as a modulus because this version of RANMAR needs a seed between 0 and 9*108 andBIG_PRIME
isn't commensurate with any regular period.BIG_PRIME= 899999963
-
-
Constructor Detail
-
Ranmar
public Ranmar(int ijkl)
Initialize Ranmar with a specified integer seed- Parameters:
ijkl
- seed integer; Ranmar(int ijkl) takes uses ijkl modulus BIG_PRIME as a seed for RANMAR.
-
Ranmar
public Ranmar(long ijkl)
Initialize Ranmar with a specified long seed- Parameters:
ijkl
- seed long; Ranmar(long ijkl) takes uses ijkl modulus BIG_PRIME as a seed for RANMAR.
-
Ranmar
public Ranmar()
Initialize Ranmar with a default seed taken from Marsaglia and Zaman's paper. Equivalent toRanmar(54217137).
-
Ranmar
public Ranmar(Date d)
Seed RANMAR from the clock.RandomElement e=new Ranmar(new Date());
- Parameters:
d
- a Date object to seed Ranmar with, typicallynew Date()
-
-
Method Detail
-
raw
public final double raw()
The generator- Specified by:
raw
in classRandomElement
- Returns:
- a pseudo random number
- See Also:
RandomJava
-
raw
public final void raw(double[] d, int n)
A version of the generator for filling arrays, inlined for speed- Overrides:
raw
in classRandomElement
- Parameters:
d
- an array of doubles to be filledn
- size of the array
-
-