C# implementation of TinyMT.
The class TinyMT.Random
is compatible with the System.Random
.
So, it can be easily replaced.
Tiny Mersenne Twister pseudo-random number generator.
Initializes a new instance with default seed and parameters.
Initializes an instance with the specified seed and default parmeters.
seed
: The seed value of pseudo-random number sequence. If a negative value is specified, the absolute value is used.
Initializes a new instance with the specified seed and default parameters.
seed
: The seed value of pseudo-random number sequence.
Initializes a new instance with the specified seed and parameters.
seed
: The seed value of pseudo-random number sequence.mat1
: State transition parameter.mat2
: State transition parameter.tmat
: Tempering parameter.
Initializes a new instance with an array of integers used as seeds, and default parameters.
initKey
: The array of 64-bit integers, used as seed.
Initializes a new instance with an array of integers used as seeds, and parameters.
initKey
: The array of 64-bit integers, used as seed.mat1
: State transition parameter.mat2
: State transition parameter.tmat
: Tempering parameter.
Returns a non-negative random integer.
A random integer (0 ≤ ret ≤ int.MaxValue
).
Returns a non-negative random integer that is less than the specified maximum.
maxValue
: The exclusive upper bound of the generated random value. this must be greater than or equal to 0.
A random integer (0 ≤ ret < maxValue
).
ArgumentOutOfRangeException
:maxValue
is less than 0.
Returns a random integer that is within a specified range.
minValue
: The inclusive lower bound of the generated random value.maxValue
: The exclusive upper bound of the generated random value. this must be greater than or equal tominValue
A random integer (minValue
≤ ret < maxValue
).
ArgumentOutOfRangeException
: minValue
is greater than maxValue
.
Returns a random 64bit unsigned integer.
A random integer (0 ≤ ret < 2^64).
Fills the elements of a specified array of bytes with random numbers.
Each element of the array is set to a random value (0 ≤ value ≤ byte.MaxValue
).
buffer
: The array to be filled with random numbers.
ArgumentNullException
:buffer
is null.
Fills the elements of a specified array of bytes with random numbers. Each element of the array is set to a random value (0 ≤ value ≤ byte.MaxValue).
buffer
: The array to be filled with random numbers.
Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0.
A double-precision floating point number (0.0 ≤ ret < 1.0).
Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0.
A double-precision floating point number (0.0 ≤ ret < 1.0).
Returns a random floating-point number that is greater than or equal to 1.0, and less than 2.0.
A double-precision floating point number (1.0 ≤ ret < 2.0).
Returns a random floating-point number that is greater than 0.0, and less than or equal to 1.0.
A double-precision floating point number (0.0 < ret ≤ 1.0).
Returns a random floating-point number that is greater than 0.0, and less than 1.0.
A double-precision floating point number (0.0 < ret < 1.0).