C# Class RandomOps.RanSystem

Wrapper for the .NET built-in PRNG. Not thread-safe by default.
Since the .NET implementation may change we cannot override and make a more efficient implementation of Byte() that would use bit-manipulation, because it would assume things about the implementation that might change.
Inheritance: Random
Exibir arquivo Open project: DanWBR/dwsim3

Public Methods

Method Description
Bool ( ) : bool

Draw a random boolean with equal probability of drawing true or false.

Byte ( ) : byte

Draw a random and uniform byte.

Bytes ( int length ) : byte[]

Draw an array of random and uniform bytes.

Index ( int n ) : int

Draw a random index from the range {0, .., n-1}

RanSystem ( )

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

RanSystem ( int seed )

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.

Uniform ( ) : double

Draw a uniform random number in the exclusive range (0,1)

Method Details

Bool() public final method

Draw a random boolean with equal probability of drawing true or false.
public final Bool ( ) : bool
return bool

Byte() public final method

Draw a random and uniform byte.
public final Byte ( ) : byte
return byte

Bytes() public final method

Draw an array of random and uniform bytes.
public final Bytes ( int length ) : byte[]
length int The array length requested.
return byte[]

Index() public final method

Draw a random index from the range {0, .., n-1}
public final Index ( int n ) : int
n int The exclusive upper bound.
return int

RanSystem() 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 RanSystem ( )

RanSystem() 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 RanSystem ( int seed )
seed int

Uniform() public final method

Draw a uniform random number in the exclusive range (0,1)
public final Uniform ( ) : double
return double