Click or drag to resize

RandMT Class

32-bit implementation of the Mersenne Twister random number generator algorithm by Makoto Matsumoto and Takuji Nishimura.
Inheritance Hierarchy
System.Object
  System.Random
    Orthogonal.Common.Basic.PRNG.RandCustomBase
      Orthogonal.Common.Basic.PRNG.RandMT

Namespace: Orthogonal.Common.Basic.PRNG
Assembly: Orthogonal.Common.Basic (in Orthogonal.Common.Basic.dll) Version: 2025-03-15 14:42 GMT+11
Syntax
C#
public class RandMT : RandCustomBase

The RandMT type exposes the following members.

Constructors
 NameDescription
Public methodRandMT() Creates a random number generator with a random seed.
Public methodRandMT(Int32) Creates a random number generator seeded with a specified integer.
Public methodRandMT(Int32[]) Creates a random number generator seeded with a specified integer array.
Top
Methods
 NameDescription
Public methodNextDouble53This method was in the original C code. It is probably a cryptic way of combining two 32-bit numbers into a 64-bit number which then has 53 bits converted into a floating-point number so that all possible values can be produced. A shift-and-multiply is an easier way to do that. This method remains in the class as a reference.
Public methodNextInt64
(Overrides RandCustomBase.NextInt64())
Public methodRandUint32 Generates a random unsigned integer in the interval [0,0xFFFFFFFF]. This methods was a public function in the original C code, so it remains here as a reference. It is not part of the standard Random class interface.
Top
Remarks

Long running tests have observed the expected minimum values Next 0 (0x0) and Core 0.0 and the expected maximum Next 2147483646 (0x7FFFFFFE) from Core 0.999999999790607.

See Also