Mersenne Twister Constructor
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Overload List
| Mersenne | Constructs a new MersenneTwister class using a time-dependent default seed value. |
| Mersenne | Initializes a new instance of the MersenneTwister class using the specified integer seed value. |
| Mersenne | Initializes a new instance of the MersenneTwister class using the specified array of integer seeds. |
| Mersenne | Initializes a new instance of the MersenneTwister class with the specified options. |
| Mersenne | Initializes a new instance of the MersenneTwister class from saved state. |
| Mersenne | Constructs a new MersenneTwister class using the specified seed value. |
| Mersenne | Constructs a new MersenneTwister class using the specified seed array of seed values. |
| Mersenne | Constructs a new MersenneTwister class using the specified seed value. |
| Mersenne | Constructs a new MersenneTwister class using the specified seed array of seed values. |
MersenneTwister
public MersenneTwister()Remarks
Although the seed value is time-dependent, it may not change fast enough to be different on successive invocations. To ensure two or more random sequences are different, provide different seed values explicitly.
MersenneTwister(Int32)
public MersenneTwister(
int seed
)Parameters
- seed Int32
- The seed value used to initialize the random number generator. Using the same seed produces the same sequence of random numbers.
Remarks
MersenneTwister(Int32[])
public MersenneTwister(
int[] seeds
)Parameters
- seeds Int32[]
- An array of 32-bit signed integers to use as the initial seed values for the random number generator.
Remarks
MersenneTwister(RandomOptions)
public MersenneTwister(
RandomOptions options
)Parameters
- options RandomOptions
- The initialization options containing seed, stream ID, and seed profile.
MersenneTwister(ReadOnlySpan<Byte>)
public MersenneTwister(
ReadOnlySpan<byte> state
)Parameters
- state ReadOnlySpan<Byte>
- The saved state to restore.
Exceptions
| Argument | The length of state is less than the required state size. |
MersenneTwister(Int64, SeedProfile)
public MersenneTwister(
long seed,
SeedProfile seedProfile = SeedProfile.Default
)Parameters
- seed Int64
- A number used to calculate a starting value for the pseudo-random number sequence.
- seedProfile SeedProfile (Optional)
Remarks
Different seeds produce different random sequences. You can produce the same sequence repeatedly by providing the same seed value each time.
MersenneTwister(ReadOnlySpan<UInt32>, SeedProfile)
public MersenneTwister(
ReadOnlySpan<uint> seedMaterial,
SeedProfile seedProfile = SeedProfile.Default
)Parameters
- seedMaterial ReadOnlySpan<UInt32>
- An array of integers used to calculate a starting value for the pseudo-random number sequence.
- seedProfile SeedProfile (Optional)
Remarks
The maximum length of seedMaterial is 16383. All elements after the 16383rd element are ignored.
Different seeds produce different random sequences. You can produce the same sequence repeatedly by providing the same seed value each time.
Exceptions
| Argument | seedMaterial is null. |
MersenneTwister(Int64, StreamAddress, SeedProfile)
public MersenneTwister(
long seed,
StreamAddress streamAddress,
SeedProfile seedProfile = SeedProfile.Default
)Parameters
- seed Int64
- A number used to calculate a starting value for the pseudo-random number sequence.
- streamAddress StreamAddress
- Optional stream identifier for stream selection.
- seedProfile SeedProfile (Optional)
- The seed profile to use for initialization.
MersenneTwister(ReadOnlySpan<UInt32>, StreamAddress, SeedProfile)
public MersenneTwister(
ReadOnlySpan<uint> seedMaterial,
StreamAddress streamAddress,
SeedProfile seedProfile = SeedProfile.Default
)Parameters
- seedMaterial ReadOnlySpan<UInt32>
- An array of integers used to calculate a starting value for the pseudo-random number sequence.
- streamAddress StreamAddress
- Optional stream identifier for stream selection.
- seedProfile SeedProfile (Optional)
- The seed profile to use for initialization.
Exceptions
| Argument | seedMaterial is null. |