C# Class YAMP.Numerics.Generator

Declares common functionality for all random number generators.
Show file Open project: FlorianRappl/YAMP Class Usage Examples

Public Methods

Method Description
Next ( ) : int

Returns a nonnegative random number less than MaxValue.

Next ( int maxValue ) : int

Returns a nonnegative random number less than the specified maximum.

Next ( int minValue, int maxValue ) : int

Returns a random number within the specified range.

NextBoolean ( ) : bool

Returns a random Boolean value.

Buffers 31 random bits for future calls, so the random number generator is only invoked once in every 31 calls.

NextBytes ( byte buffer ) : void

Fills the elements of a specified array of bytes with random numbers.

Each element of the array of bytes is set to a random number greater than or equal to 0, and less than or equal to Byte.MaxValue.

NextDouble ( ) : double

Returns a nonnegative floating point random number less than 1.0.

NextDouble ( double maxValue ) : double

Returns a nonnegative floating point random number less than the specified maximum.

NextDouble ( double minValue, double maxValue ) : double

Returns a floating point random number within the specified range.

Reset ( ) : bool

Resets the random number generator, so that it produces the same random number sequence again.

Method Details

Next() public abstract method

Returns a nonnegative random number less than MaxValue.
public abstract Next ( ) : int
return int

Next() public abstract method

Returns a nonnegative random number less than the specified maximum.
public abstract Next ( int maxValue ) : int
maxValue int /// The exclusive upper bound of the random number to be generated. /// must be greater than or equal to 0. ///
return int

Next() public abstract method

Returns a random number within the specified range.
public abstract Next ( int minValue, int maxValue ) : int
minValue int /// The inclusive lower bound of the random number to be generated. ///
maxValue int /// The exclusive upper bound of the random number to be generated. /// MaxValue must be greater than or equal to MinValue. ///
return int

NextBoolean() public abstract method

Returns a random Boolean value.
Buffers 31 random bits for future calls, so the random number generator is only invoked once in every 31 calls.
public abstract NextBoolean ( ) : bool
return bool

NextBytes() public abstract method

Fills the elements of a specified array of bytes with random numbers.
Each element of the array of bytes is set to a random number greater than or equal to 0, and less than or equal to Byte.MaxValue.
public abstract NextBytes ( byte buffer ) : void
buffer byte An array of bytes to contain random numbers.
return void

NextDouble() public abstract method

Returns a nonnegative floating point random number less than 1.0.
public abstract NextDouble ( ) : double
return double

NextDouble() public abstract method

Returns a nonnegative floating point random number less than the specified maximum.
public abstract NextDouble ( double maxValue ) : double
maxValue double /// The exclusive upper bound of the random number to be generated. /// MaxValue must be greater than or equal to 0.0. ///
return double

NextDouble() public abstract method

Returns a floating point random number within the specified range.
public abstract NextDouble ( double minValue, double maxValue ) : double
minValue double /// The inclusive lower bound of the random number to be generated. /// The range between and MaxValue must be less than or equal to /// MaxValue. ///
maxValue double /// The exclusive upper bound of the random number to be generated. /// MaxValue must be greater than or equal to . /// The range between and must be less than or equal to /// . ///
return double

Reset() public abstract method

Resets the random number generator, so that it produces the same random number sequence again.
public abstract Reset ( ) : bool
return bool