Assembly: Extreme.Numerics (Extreme.Numerics)
Syntax
| Visual Basic (Declaration) |
|---|
Public NotInheritable Class MersenneTwister _ Inherits RandomWordGenerator |
| C# |
|---|
public sealed class MersenneTwister : RandomWordGenerator |
| C++ |
|---|
public ref class MersenneTwister sealed : public RandomWordGenerator |
Methods
| Icon | Type | Description |
|---|---|---|
| Equals(Object) | ||
| Fill(Double[]()) |
Fills a Double array with random numbers.
| |
| Fill(Vector) |
Fills a Vector with random numbers.
| |
| Fill(Double[](), Int32, Int32) |
Fills a Double array with random numbers.
| |
| Fill(Double[](), ContinuousDistribution) |
Fills a Double array with random samples from the specified distribution.
| |
| Fill(Vector, ContinuousDistribution) |
Fills a Vector with random samples from the specified distribution.
| |
| Fill(Double[](), Int32, Int32, ContinuousDistribution) |
Fills a Double array with random samples from the specified distribution.
| |
| Fill(Int32[]()) |
Fills an Int32 array with random numbers.
| |
| Fill(Int32[](), Int32, Int32) |
Fills an Int32 array with random numbers.
| |
| Fill(Int32[](), DiscreteDistribution) |
Fills an Int32 array with random samples from the specified distribution.
| |
| Fill(Vector, DiscreteDistribution) |
Fills a Vector with random samples from the specified distribution.
| |
| Fill(Int32[](), Int32, Int32, DiscreteDistribution) |
Fills an Int32 array with random samples from the specified distribution.
| |
| Finalize() | ||
| GenerateNextWord() |
Advances the sequence of random numbers by one and
updates the CurrentValue of the
random number generator.
| |
| GetHashCode() | Serves as a hash function for a particular type. | |
| GetType() | Gets the Type of the current instance. | |
| MemberwiseClone() | Creates a shallow copy of the current Object. | |
| Next() |
Returns a nonnegative random number.
| |
| Next(DiscreteDistribution) |
Returns a sample from the specified distribution.
| |
| Next(Int32, Int32) | Returns a random number within a specified range. | |
| Next(Int32) | Returns a nonnegative random number less than the specified maximum. | |
| NextBytes(Byte[]()) |
Fills the elements of a specified array of bytes with random numbers.
| |
| NextDouble() |
Returns a random number between 0 and 1.
| |
| NextDouble(ContinuousDistribution) |
Returns a sample from the specified distribution.
| |
| Sample() |
Returns a random number between 0 and 1.
| |
| ToString() |
Constructors
| Icon | Type | Description |
|---|---|---|
| MersenneTwisterNew() |
Initializes a new instance of the MersenneTwister class
using a time-dependent default seed value.
| |
| MersenneTwisterNew(Int32) |
Initializes a new instance of the MersenneTwister class
using the specified seed value.
| |
| MersenneTwisterNew(Int32[]()) |
Initializes a new instance of the MersenneTwister class
using the specified seed array of seed values.
|
Properties
| Icon | Type | Description |
|---|---|---|
| CurrentValue |
Gets or sets the current random 32-bit word.
|
Remarks
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.
Inheritance Hierarchy
System.Random
Extreme.Statistics.Random.ExtendedRandom
Extreme.Statistics.Random.RandomWordGenerator
Extreme.Statistics.Random.MersenneTwister