Represents a pseudo-random number generator based on the Mersenne Twister algorithm.

Namespace: Extreme.Statistics.Random
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

IconTypeDescription
Equals(Object)
Determines whether the specified Object is equal to the current 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()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
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()
Returns a String that represents the current Object.

Constructors

IconTypeDescription
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

IconTypeDescription
CurrentValue
Gets or sets the current random 32-bit word.

Remarks

Use the MersenneTwister class to represent a pseudo-_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.

Inheritance Hierarchy

System.Object
  System.Random
    Extreme.Statistics.Random.ExtendedRandom
      Extreme.Statistics.Random.RandomWordGenerator
        Extreme.Statistics.Random.MersenneTwister