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

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

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

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

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

Draw a random boolean with equal probability of drawing true or false.
public final Bool ( ) : bool
Результат bool

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

Draw a random and uniform byte.
public final Byte ( ) : byte
Результат byte

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

Draw an array of random and uniform bytes.
public final Bytes ( int length ) : byte[]
length int The array length requested.
Результат byte[]

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

Draw a random index from the range {0, .., n-1}
public final Index ( int n ) : int
n int The exclusive upper bound.
Результат int

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

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() публичный Метод

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() публичный закрытый Метод

Draw a uniform random number in the exclusive range (0,1)
public final Uniform ( ) : double
Результат double