C# Класс 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.
Наследование: RanInt32
Показать файл Открыть проект

Открытые методы

Метод Описание
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}

Защищенные методы

Метод Описание
Seed ( Int32 seed ) : void

Seed with an integer.

Описание методов

Ran2() публичный Метод

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
Результат System

Ran2() публичный Метод

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
Результат System

Rand() публичный закрытый Метод

Draw a random number in inclusive range {0, .., RandMax}
public final Rand ( ) : Int32
Результат System.Int32

Seed() защищенный закрытый Метод

Seed with an integer.
protected final Seed ( Int32 seed ) : void
seed System.Int32
Результат void