Mersenne Twister Class
Definition
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
[SerializableAttribute]
public sealed class MersenneTwister : RandomWordGenerator
- Inheritance
- Object → Random → ExtendedRandom → RandomWordGenerator → MersenneTwister
Remarks
Use the MersenneTwister class to represent a pseudo-this.random number generator that uses the Mersenne Twister algorithm of Takuji Nishimura and Makoto Matsumoto.
This generator has a very long period of 219937-1. This period is a Mersenne prime number (since 19937 is prime), whence its name. The algorithm is very fast and produces very good random sequences.
MersenneTwister can be used in place of the Random class to obtain pseudo-random numbers of a higher quality.
The Mersenne Twister is a linear random number generator. This makes it unsuitable for use in cryptography applications. To generate a cryptographically secure random number suitable for creating a random password, for example, use a class derived from RandomNumberGenerator such as RNGCryptoServiceProvider.
Constructors
Mersenne | Initializes a new instance of the MersenneTwister class using a time-dependent default seed value. |
Mersenne | Initializes a new instance of the MersenneTwister class using the specified seed value. |
Mersenne | Initializes a new instance of the MersenneTwister class using the specified seed array of seed values. |
Methods
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetHashCode | Serves as the default hash function. (Inherited from Object) |
GetItems``1(UMP[], Int32) | Creates an array populated with items chosen at random from the provided set of choices. (Inherited from Random) |
GetItems``1(ReadOnlySpan<UMP>, Int32) | Creates an array populated with items chosen at random from the provided set of choices. (Inherited from Random) |
GetItems``1(ReadOnlySpan<UMP>, Span<UMP>) | Fills the elements of a specified span with items chosen at random from the provided set of choices. (Inherited from Random) |
GetType | Gets the Type of the current instance. (Inherited from Object) |
Next() |
Returns a nonnegative random number.
(Inherited from RandomWordGenerator) |
Next(Int32) | Returns a non-negative random integer that is less than the specified maximum. (Inherited from Random) |
Next(Int32, Int32) | Returns a random integer that is within a specified range. (Inherited from Random) |
Next |
Fills the elements of a specified array of bytes with random numbers.
(Inherited from RandomWordGenerator) |
NextBytes(Span<Byte>) | Fills the elements of a specified span of bytes with random numbers. (Inherited from Random) |
Next |
Returns a random number between 0 and 1.
(Inherited from RandomWordGenerator) |
Next |
Returns a random number between 0 and 1.
(Inherited from RandomWordGenerator) |
NextInt64() | Returns a non-negative random integer. (Inherited from Random) |
NextInt64(Int64) | Returns a non-negative random integer that is less than the specified maximum. (Inherited from Random) |
NextInt64(Int64, Int64) | Returns a random integer that is within a specified range. (Inherited from Random) |
NextSingle | Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0. (Inherited from Random) |
Restart() |
Restarts the random number generator using the original seed.
(Overrides ExtendedRandom.Restart()) |
Restart( |
Restarts the random number generator using the specified seed.
(Overrides ExtendedRandom.Restart(Int32)) |
Restart(Int32[]) | Restarts the random number generator using the specified seed array. |
Shuffle``1(UMP[]) | Performs an in-place shuffle of an array. (Inherited from Random) |
Shuffle``1(Span<UMP>) | Performs an in-place shuffle of a span. (Inherited from Random) |
ToString | Returns a string that represents the current object. (Inherited from Object) |
Extension Methods
AsParallel |
Returns a thread-safe version of this random number generator.
(Defined by RandomExtensions) |
Correlated |
Generates a series of random variables with the specified correlation matrix.
(Defined by RandomExtensions) |
Fill |
Fills a Double array with random numbers.
(Defined by RandomExtensions) |
Fill |
Fills an Int32 array with random numbers.
(Defined by RandomExtensions) |
Fill |
Fills a Double array with random samples from the specified distribution.
(Defined by RandomExtensions) |
Fill |
Fills an Int32 array with random samples from the specified distribution.
(Defined by RandomExtensions) |
Fill |
Fills a vector with random samples from the specified distribution.
(Defined by RandomExtensions) |
Fill |
Fills a vector with random samples from the specified distribution.
(Defined by RandomExtensions) |
Fill |
Fills a Double array with random samples from the specified distribution.
(Defined by RandomExtensions) |
Fill |
Fills a Double array with random numbers.
(Defined by RandomExtensions) |
Fill |
Fills an Int32 array with random numbers.
(Defined by RandomExtensions) |
Fill |
Fills an Int32 array with random samples from the specified distribution.
(Defined by RandomExtensions) |
Fill |
Fills a Double array with random samples from the specified distribution.
(Defined by RandomExtensions) |
Fill |
Fills an Int32 array with random samples from the specified distribution.
(Defined by RandomExtensions) |
Fill |
Fills a list with normal random numbers with zero mean and unit
standard deviation.
(Defined by RandomExtensions) |
Fill |
Fills a list with normal random numbers with zero mean and unit
standard deviation.
(Defined by RandomExtensions) |
Next |
Returns a sample from the specified distribution.
(Defined by RandomExtensions) |
Next |
Returns a sample from the specified distribution.
(Defined by RandomExtensions) |