edu.cornell.lassp.houle.RngPack
Class Ranecu

java.lang.Object
  extended byedu.cornell.lassp.houle.RngPack.RandomElement
      extended byedu.cornell.lassp.houle.RngPack.RandomSeedable
          extended byedu.cornell.lassp.houle.RngPack.Ranecu
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Ranecu
extends RandomSeedable
implements java.io.Serializable

Ranecu is an advanced multiplicative linear congruential random number generator with a period of aproximately 1018. Ranecu is a direct translation from Fortran of the RANECU subroutine published in the paper
F. James, Comp. Phys. Comm. 60 (1990) p 329-344
The algorithm was originally described in
P. L'Ecuyer, Commun. ACM. 1988 (1988) p 742

Source code is available.

See Also:
Serialized Form

Field Summary
static int DEFSEED1
          default iseed1 = 12345
static int DEFSEED2
          default iseed2 = 67890
 
Constructor Summary
Ranecu()
          Initialize RANECU with the default seeds from James.
Ranecu(java.util.Date d)
           
Ranecu(int s1, int s2)
          Initialize RANECU with two specified integer seeds.
Ranecu(long l)
           
 
Method Summary
 long getSeed()
           
 double raw()
          The abstract method that must be defined to make a working RandomElement.
 void raw(double[] d, int n)
          This is an inline version that returns an array of doubles for speed.
 
Methods inherited from class edu.cornell.lassp.houle.RngPack.RandomSeedable
ClockSeed, ClockSeed
 
Methods inherited from class edu.cornell.lassp.houle.RngPack.RandomElement
choose, choose, clone, coin, coin, gaussian, gaussian, powlaw, raw, uniform
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFSEED1

public static int DEFSEED1
default iseed1 = 12345


DEFSEED2

public static int DEFSEED2
default iseed2 = 67890

Constructor Detail

Ranecu

public Ranecu()
Initialize RANECU with the default seeds from James.


Ranecu

public Ranecu(int s1,
              int s2)
Initialize RANECU with two specified integer seeds. Use this to introduce repeatable seeds. Equivalent to Ranecu(s1*(long) Integer.MAX_VALUE)+s2)

Parameters:
s1 - seed integer 1 (MSW)
s2 - seed integer 2 (LSW)

Ranecu

public Ranecu(long l)

Ranecu

public Ranecu(java.util.Date d)
Method Detail

raw

public final double raw()
Description copied from class: RandomElement
The abstract method that must be defined to make a working RandomElement. See the class RandomJava for an example of how to do this.

Specified by:
raw in class RandomElement
Returns:
a random double in the range [0,1]
See Also:
RandomElement.raw()

raw

public final void raw(double[] d,
                      int n)
This is an inline version that returns an array of doubles for speed.

Overrides:
raw in class RandomElement
Parameters:
d - array to be filled with doubles
n - number of doubles to generate

getSeed

public long getSeed()
Returns:
the current generator state as a long. Can be used to restart the generator where one left off.