C# Class RandomOps.Ran2

Pseudo-Random Number Generator (PRNG) based on the Ran2 algorithm from the book: 'Numerical Recipes in C' chapter 7.1 and which is originally due to L'Ecuyer with Bays-Durham shuffle and added safeguards. Period is greater than 2 * 10^18. Not thread-safe.
We MUST use division when generating random integers in a certain range. Do NOT use bit-manipulation because the low-order bits of are not that random! This works by default because Uniform() is used for creating integers through the implementation of the Index() methods in the Random base-class.
Inheritance: RanInt32
Mostrar archivo Open project: DanWBR/dwsim3

Public Methods

Method Description
Ran2 ( ) : System

Constructs the PRNG-object and seeds the PRNG with the current time of day. This is what you will mostly want to use.

Ran2 ( Int32 seed ) : System

Constructs the PRNG-object using the designated seed. This is useful if you want to repeat experiments with the same sequence of pseudo-random numbers.

Rand ( ) : Int32

Draw a random number in inclusive range {0, .., RandMax}

Protected Methods

Method Description
Seed ( Int32 seed ) : void

Seed with an integer.

Method Details

Ran2() public method

Constructs the PRNG-object and seeds the PRNG with the current time of day. This is what you will mostly want to use.
public Ran2 ( ) : System
return System

Ran2() public method

Constructs the PRNG-object using the designated seed. This is useful if you want to repeat experiments with the same sequence of pseudo-random numbers.
public Ran2 ( Int32 seed ) : System
seed System.Int32
return System

Rand() public final method

Draw a random number in inclusive range {0, .., RandMax}
public final Rand ( ) : Int32
return System.Int32

Seed() protected final method

Seed with an integer.
protected final Seed ( Int32 seed ) : void
seed System.Int32
return void