Namespaces

Types in MathNet.Numerics.Random

Type RandomExtensions

Namespace MathNet.Numerics.Random

This class implements extension methods for the System.Random class. The extension methods generate pseudo-random distributed numbers for types other than double and int32.

Static Functions

Public Static Functions

IEnumerable<BigInteger> NextBigIntegerSequence(this Random rnd, BigInteger minInclusive, BigInteger maxExclusive)

Returns an infinite sequence of uniform random BigInteger within the specified range.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.

bool NextBoolean(this Random rnd)

Returns a random boolean.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.
Parameters
Random rnd

The random number generator.

Byte[] NextBytes(this Random rnd, int count)

Returns an array of uniform random bytes.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.
Parameters
Random rnd

The random number generator.

int count

The size of the array to fill.

decimal NextDecimal(this Random rnd)

Returns a nonnegative decimal floating point random number less than 1.0.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.
Parameters
Random rnd

The random number generator.

Return
decimal

A decimal floating point number greater than or equal to 0.0, and less than 1.0; that is, the range of return values includes 0.0 but not 1.0.

void NextDoubles(this Random rnd, Double[] values)

Fills an array with uniform random numbers greater than or equal to 0.0 and less than 1.0.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.
Parameters
Random rnd

The random number generator.

Double[] values

The array to fill with random values.

Double[] NextDoubles(this Random rnd, int count)

Returns an array of uniform random numbers greater than or equal to 0.0 and less than 1.0.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.
Parameters
Random rnd

The random number generator.

int count

The size of the array to fill.

IEnumerable<double> NextDoubleSequence(this Random rnd)

Returns an infinite sequence of uniform random numbers greater than or equal to 0.0 and less than 1.0.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.

int NextFullRangeInt32(this Random rnd)

Returns a random number of the full Int32 range.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.
Parameters
Random rnd

The random number generator.

Return
int

A 32-bit signed integer of the full range, including 0, negative numbers, MaxValue and MinValue.

long NextFullRangeInt64(this Random rnd)

Returns a random number of the full Int64 range.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.
Parameters
Random rnd

The random number generator.

Return
long

A 64-bit signed integer of the full range, including 0, negative numbers, MaxValue and MinValue.

void NextInt32s(this Random rnd, Int32[] values)

Fills an array with uniform random 32-bit signed integers greater than or equal to zero and less than MaxValue.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.
Parameters
Random rnd

The random number generator.

Int32[] values

The array to fill with random values.

void NextInt32s(this Random rnd, Int32[] values, int minInclusive, int maxExclusive)

Fills an array with uniform random 32-bit signed integers within the specified range.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.
Parameters
Random rnd

The random number generator.

Int32[] values

The array to fill with random values.

int minInclusive

Lower bound, inclusive.

int maxExclusive

Upper bound, exclusive.

IEnumerable<int> NextInt32Sequence(this Random rnd, int minInclusive, int maxExclusive)

Returns an infinite sequence of uniform random 32-bit signed integers within the specified range.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.

long NextInt64(this Random rnd)

Returns a nonnegative random number less than MaxValue.
This extension is thread-safe if and only if called on an random number generator provided by Math.NET Numerics or derived from the RandomSource class.
Parameters
Random rnd

The random number generator.

Return
long

A 64-bit signed integer greater than or equal to 0, and less than MaxValue ; that is, the range of return values includes 0 but not MaxValue.