C# Class RandomOps.RanUInt32

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 Class Usage Examples

Méthodes publiques

Méthode Description
Bool ( ) : bool

Draw a random boolean with equal probability of drawing 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.

RanUInt32 ( ) : System

Constructs the PRNG-object.

Rand ( ) : UInt32

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 ( UInt32 seed ) : void

Seed with an integer.

Method Details

Bool() public méthode

Draw a random boolean with equal probability of drawing 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

RanUInt32() public méthode

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

Rand() public abstract méthode

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

Seed() protected méthode

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

Seed() protected méthode

Seed with an integer.
protected Seed ( UInt32 seed ) : void
seed System.UInt32
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