RandomExtensions Class

Provides additional extension methods for Random.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
C#
public static class RandomExtensions
Inheritance
Object  →  RandomExtensions

Remarks

This class extends the standard .NET Random type with extra functionality that may not be available on all target frameworks, such as additional overloads and span-based methods.

These extensions are intended for convenience when working with existing APIs that use Random.

Methods

Fill(Random, IList<Double>) Fills a Double array with random numbers.
Fill(Random, IList<Int32>) Fills an Int32 array with random numbers.
Fill(Random, IList<Double>, Int32, Int32) Fills a Double array with random numbers.
Fill(Random, IList<Int32>, Int32, Int32) Fills an Int32 array with random numbers.
FillNormal(Random, IList<Double>) Fills a list with normal random numbers with zero mean and unit standard deviation.
FillNormal(Random, IList<Double>, Int32, Int32) Fills a list with normal random numbers with zero mean and unit standard deviation.
FillWithoutReplacement Populates the specified span with numbers chosen at random between 0 and the provided count without replacement.
GetItemsWithoutReplacement<T>(Random, T[], Int32) Creates an array populated with items chosen at random from the provided set of choices without replacement.
GetItemsWithoutReplacement<T>(Random, ReadOnlySpan<T>, Int32) Creates an array populated with items chosen at random from the provided set of choices without replacement.
GetItemsWithoutReplacement<T>(Random, ReadOnlySpan<T>, Span<T>) Populates the specified span with items chosen at random from the provided set of choices without replacement.
NextUInt32(Random) Returns a random 64-bit integer.
NextUInt32(Random, UInt32) Returns a random unsigned integer less than the specified value.
NextUInt64(Random) Returns a random 64-bit integer.
NextUInt64(Random, UInt64) Returns a non-negative random integer that is less than the specified maximum.

See Also