C# 클래스 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().
상속: Random
파일 보기 프로젝트 열기: DanWBR/dwsim3

공개 메소드들

메소드 설명
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}.

보호된 메소드들

메소드 설명
Seed ( ) : void

Seed with the time of day.

Seed ( Int32 seed ) : void

Seed with an integer.

메소드 상세

Bool() 공개 메소드

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

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.
public Byte ( ) : byte
리턴 byte

RanInt32() 공개 메소드

Constructs the PRNG-object.
public RanInt32 ( ) : System
리턴 System

Rand() 공개 추상적인 메소드

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

Seed() 보호된 메소드

Seed with the time of day.
protected Seed ( ) : void
리턴 void

Seed() 보호된 추상적인 메소드

Seed with an integer.
protected abstract Seed ( Int32 seed ) : void
seed System.Int32
리턴 void

Uniform() 공개 메소드

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
리턴 double