C# Class RandomOps.RanInt32

Pseudo-Random Number Generator (PRNG) base-class for a generator of UInt32 integers.
It is somewhat tricky to implement Index() using integer-operations and get the rounding right for all cases, so we reuse the base-class implementation which indirectly uses Uniform().
Inheritance: Random
Afficher le fichier Open project: DanWBR/dwsim3

Méthodes publiques

Méthode Description
Bool ( ) : bool

Draw a random boolean with equal probability of true or false. Thread-safe if Rand() is thread-safe.

Byte ( ) : byte

Draw a random and uniform byte. Thread-safe if Rand() is thread-safe.

The least significant bits are not that statistically random, hence we must use the most significant bits by a bit-shift.

RanInt32 ( ) : System

Constructs the PRNG-object.

Rand ( ) : Int32

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

Uniform ( ) : double

Draw a uniform random number in the exclusive range (0,1) Thread-safe if Rand() is thread-safe.

Assumes that Rand() is in {0, .., RandMax}.

Méthodes protégées

Méthode Description
Seed ( ) : void

Seed with the time of day.

Seed ( Int32 seed ) : void

Seed with an integer.

Method Details

Bool() public méthode

Draw a random boolean with equal probability of true or false. Thread-safe if Rand() is thread-safe.
public Bool ( ) : bool
Résultat bool

Byte() public méthode

Draw a random and uniform byte. Thread-safe if Rand() is thread-safe.
The least significant bits are not that statistically random, hence we must use the most significant bits by a bit-shift.
public Byte ( ) : byte
Résultat byte

RanInt32() public méthode

Constructs the PRNG-object.
public RanInt32 ( ) : System
Résultat System

Rand() public abstract méthode

Draw a random number in inclusive range {0, .., RandMax}
public abstract Rand ( ) : Int32
Résultat System.Int32

Seed() protected méthode

Seed with the time of day.
protected Seed ( ) : void
Résultat void

Seed() protected abstract méthode

Seed with an integer.
protected abstract Seed ( Int32 seed ) : void
seed System.Int32
Résultat void

Uniform() public méthode

Draw a uniform random number in the exclusive range (0,1) Thread-safe if Rand() is thread-safe.
Assumes that Rand() is in {0, .., RandMax}.
public Uniform ( ) : double
Résultat double