C# Class YAMP.Numerics.MT19937Generator

Represents a Mersenne Twister pseudo-random number generator with period 2^19937-1.
The MT19937Generator type bases upon information and the implementation presented on the Mersenne Twister Home Page.
Inheritance: Generator
Afficher le fichier Open project: FlorianRappl/YAMP

Méthodes publiques

Méthode Description
MT19937Generator ( ) : System

Initializes a new instance of the MT19937Generator class, using a time-dependent default seed value.

MT19937Generator ( int seed ) : System

Initializes a new instance of the MT19937Generator class, using the specified seed value.

MT19937Generator ( uint seed ) : System

Initializes a new instance of the MT19937Generator class, using the specified seed value.

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 32 random bits (1 uint) for future calls, so a new random number is only generated every 32 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.

NextInclusiveMaxValue ( ) : int

Returns a nonnegative random number less than or equal to MaxValue.

NextUInt ( ) : uint

Returns an unsigned random number.

Reset ( ) : bool

Resets the MT19937Generator, so that it produces the same pseudo-random number sequence again.

Private Methods

Méthode Description
GenerateNUInts ( ) : void

Generates MT19937Generator.N unsigned random numbers.

Generated random numbers are 32-bit unsigned integers greater than or equal to UInt32.MinValue and less than or equal to UInt32.MaxValue.

ResetBySeedArray ( ) : void

Extends resetting of the MT19937Generator using the seedArray.

ResetGenerator ( ) : void

Resets the MT19937Generator, so that it produces the same pseudo-random number sequence again.

Method Details

MT19937Generator() public méthode

Initializes a new instance of the MT19937Generator class, using a time-dependent default seed value.
public MT19937Generator ( ) : System
Résultat System

MT19937Generator() public méthode

Initializes a new instance of the MT19937Generator class, using the specified seed value.
public MT19937Generator ( int seed ) : System
seed int /// A number used to calculate a starting value for the pseudo-random number sequence. /// If a negative number is specified, the absolute value of the number is used. ///
Résultat System

MT19937Generator() public méthode

Initializes a new instance of the MT19937Generator class, using the specified seed value.
public MT19937Generator ( uint seed ) : System
seed uint /// An unsigned number used to calculate a starting value for the pseudo-random number sequence. ///
Résultat System

Next() public méthode

Returns a nonnegative random number less than MaxValue.
public Next ( ) : int
Résultat int

Next() public méthode

Returns a nonnegative random number less than the specified maximum.
/// is less than 0. ///
public 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. ///
Résultat int

Next() public méthode

Returns a random number within the specified range.
/// is greater than . ///
public 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. /// must be greater than or equal to . ///
Résultat int

NextBoolean() public méthode

Returns a random Boolean value.
Buffers 32 random bits (1 uint) for future calls, so a new random number is only generated every 32 calls.
public NextBoolean ( ) : bool
Résultat bool

NextBytes() public méthode

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.
/// is a null reference ( in Visual Basic). ///
public NextBytes ( byte buffer ) : void
buffer byte An array of bytes to contain random numbers.
Résultat void

NextDouble() public méthode

Returns a nonnegative floating point random number less than 1.0.
public NextDouble ( ) : double
Résultat double

NextDouble() public méthode

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

NextDouble() public méthode

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

NextInclusiveMaxValue() public méthode

Returns a nonnegative random number less than or equal to MaxValue.
public NextInclusiveMaxValue ( ) : int
Résultat int

NextUInt() public méthode

Returns an unsigned random number.
public NextUInt ( ) : uint
Résultat uint

Reset() public méthode

Resets the MT19937Generator, so that it produces the same pseudo-random number sequence again.
public Reset ( ) : bool
Résultat bool