RandomNumberGenerator.GetItems Method

Definition

Overloads

GetItems<T>(ReadOnlySpan<T>, Int32)

Creates an array populated with items chosen at random from choices.

GetItems<T>(ReadOnlySpan<T>, Span<T>)

Fills the elements of a specified span with items chosen at random from the provided set of choices.

GetItems<T>(ReadOnlySpan<T>, Int32)

Creates an array populated with items chosen at random from choices.

public:
generic <typename T>
 static cli::array <T> ^ GetItems(ReadOnlySpan<T> choices, int length);
public static T[] GetItems<T> (ReadOnlySpan<T> choices, int length);
static member GetItems : ReadOnlySpan<'T> * int -> 'T[]
Public Shared Function GetItems(Of T) (choices As ReadOnlySpan(Of T), length As Integer) As T()

Type Parameters

T

The type of items.

Parameters

choices
ReadOnlySpan<T>

The items to use to populate the array.

length
Int32

The length of array to return populated with items.

Returns

T[]

An array populated with random choices.

Exceptions

choices is empty.

length is not zero or a positive number.

Applies to

GetItems<T>(ReadOnlySpan<T>, Span<T>)

Fills the elements of a specified span with items chosen at random from the provided set of choices.

public:
generic <typename T>
 static void GetItems(ReadOnlySpan<T> choices, Span<T> destination);
public static void GetItems<T> (ReadOnlySpan<T> choices, Span<T> destination);
static member GetItems : ReadOnlySpan<'T> * Span<'T> -> unit
Public Shared Sub GetItems(Of T) (choices As ReadOnlySpan(Of T), destination As Span(Of T))

Type Parameters

T

The type of items.

Parameters

choices
ReadOnlySpan<T>

The items to use to fill the buffer.

destination
Span<T>

The buffer to receive the items.

Exceptions

choices is empty.

Applies to