Namespaces

Types in MathNet.Numerics.Random

Type SystemRandomSource

Namespace MathNet.Numerics.Random

Parent RandomSource

A random number generator based on the Random class in the.NET library.

Constructors

Static Functions

Methods

Properties

Public Constructors

SystemRandomSource(int seed, bool threadSafe)

Construct a new random number generator with random seed.
Parameters
int seed

The seed value.

bool threadSafe

if set to true , the class is thread safe.

SystemRandomSource(bool threadSafe)

Construct a new random number generator with random seed.
Parameters
bool threadSafe

if set to true , the class is thread safe.

SystemRandomSource()

Construct a new random number generator with a random seed.

SystemRandomSource(int seed)

Construct a new random number generator with random seed.
Parameters
int seed

The seed value.

Public Static Functions

void Doubles(Double[] values, int seed)

Fills an array with random numbers greater than or equal to 0.0 and less than 1.0.
Supports being called in parallel from multiple threads.

Double[] Doubles(int length, int seed)

Returns an array of random numbers greater than or equal to 0.0 and less than 1.0.
Supports being called in parallel from multiple threads.

IEnumerable<double> DoubleSequence()

Returns an infinite sequence of uniform random numbers greater than or equal to 0.0 and less than 1.0.
Supports being called in parallel from multiple threads, but the result must be enumerated from a single thread each.

IEnumerable<double> DoubleSequence(int seed)

Returns an infinite sequence of random numbers greater than or equal to 0.0 and less than 1.0.
Supports being called in parallel from multiple threads, but the result must be enumerated from a single thread each.

void FastDoubles(Double[] values)

Fill an array with uniform random numbers greater than or equal to 0.0 and less than 1.0. WARNING: potentially very short random sequence length, can generate repeated partial sequences.
Parallelized on large length, but also supports being called in parallel from multiple threads

Double[] FastDoubles(int length)

Returns an array of uniform random numbers greater than or equal to 0.0 and less than 1.0. WARNING: potentially very short random sequence length, can generate repeated partial sequences.
Parallelized on large length, but also supports being called in parallel from multiple threads

Public Methods

bool Equals(object obj)

int GetHashCode()

Type GetType()

void NextBytes(Byte[] buffer)

Fills the elements of a specified array of bytes with random numbers.
Parameters
Byte[] buffer

An array of bytes to contain random numbers.

double NextDouble()

void NextDoubles(Double[] values)

Fills an array with uniform random numbers greater than or equal to 0.0 and less than 1.0.
Parameters
Double[] values

The array to fill with random values.

Double[] NextDoubles(int count)

Returns an array of uniform random numbers greater than or equal to 0.0 and less than 1.0.
Parameters
int count

The size of the array to fill.

IEnumerable<double> NextDoubleSequence()

Returns an infinite sequence of uniform random numbers greater than or equal to 0.0 and less than 1.0.

void NextInt32s(Int32[] values, int maxExclusive)

Fills an array with random numbers within a specified range.
Parameters
Int32[] values

The array to fill with random values.

int maxExclusive

The exclusive upper bound of the random number returned. Range: maxExclusive ≥ 1.

Int32[] NextInt32s(int count, int minInclusive, int maxExclusive)

Returns an array with random 32-bit signed integers within the specified range.
Parameters
int count

The size of the array to fill.

int minInclusive

The inclusive lower bound of the random number returned.

int maxExclusive

The exclusive upper bound of the random number returned. Range: maxExclusive > minExclusive.

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

Fills an array with random numbers within a specified range.
Parameters
Int32[] values

The array to fill with random values.

int minInclusive

The inclusive lower bound of the random number returned.

int maxExclusive

The exclusive upper bound of the random number returned. Range: maxExclusive > minExclusive.

Int32[] NextInt32s(int count, int maxExclusive)

Returns an array with random 32-bit signed integers within the specified range.
Parameters
int count

The size of the array to fill.

int maxExclusive

The exclusive upper bound of the random number returned. Range: maxExclusive ≥ 1.

Int32[] NextInt32s(int count)

Returns an array with random 32-bit signed integers greater than or equal to zero and less than MaxValue.
Parameters
int count

The size of the array to fill.

void NextInt32s(Int32[] values)

Fills an array with random 32-bit signed integers greater than or equal to zero and less than MaxValue.
Parameters
Int32[] values

The array to fill with random values.

IEnumerable<int> NextInt32Sequence()

Returns an infinite sequence of random 32-bit signed integers greater than or equal to zero and less than MaxValue.

IEnumerable<int> NextInt32Sequence(int minInclusive, int maxExclusive)

Returns an infinite sequence of random numbers within a specified range.
Parameters
int minInclusive

The inclusive lower bound of the random number returned.

int maxExclusive

The exclusive upper bound of the random number returned. Range: maxExclusive > minExclusive.

string ToString()

Public Properties

SystemRandomSource Default get;

Default instance, thread-safe.