RandomExtensions.FillWithoutReplacement Method

Populates the specified span with numbers chosen at random between 0 and the provided count without replacement.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.1.2
C#
public static void FillWithoutReplacement(
	this Random random,
	int count,
	Span<int> destination
)

Parameters

random  Random
A random number generator used to generate the samples.
count  Int32
The number of items.
destination  Span<Int32>
The span to be filled with items.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Random. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

random is null.

See Also