C# Class Onism.Cldr.Test.Utils.DeterministicRandom

Once initialized with a bit array, this object returns values in a deterministic way. Facilitates recreating scenarios where some randomness is needed.
Mostra file Open project: pgolebiowski/onism-cldr Class Usage Examples

Public Methods

Method Description
DeterministicRandom ( int bitArrayLength ) : System

Initializes a new instance of the DeterministicRandom class, using a random bit array with the specified length.

DeterministicRandom ( string bits ) : System

Initializes a new instance of the DeterministicRandom class, using a string of bits (1 and 0) as an input.

NextBool ( ) : bool

Reads next bit and returns a boolean value.

NextInt ( ) : int

Reads next 32 bits and returns a non-negative integer.

ToString ( ) : string

Gets the serialized bit array.

Method Details

DeterministicRandom() public method

Initializes a new instance of the DeterministicRandom class, using a random bit array with the specified length.
public DeterministicRandom ( int bitArrayLength ) : System
bitArrayLength int
return System

DeterministicRandom() public method

Initializes a new instance of the DeterministicRandom class, using a string of bits (1 and 0) as an input.
public DeterministicRandom ( string bits ) : System
bits string
return System

NextBool() public method

Reads next bit and returns a boolean value.
public NextBool ( ) : bool
return bool

NextInt() public method

Reads next 32 bits and returns a non-negative integer.
public NextInt ( ) : int
return int

ToString() public method

Gets the serialized bit array.
public ToString ( ) : string
return string