Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

RandomNumberGenerator.GetItems Method

Definition

Namespace:
System.Security.Cryptography
Assemblies:
netstandard.dll, System.Security.Cryptography.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Name Description
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)

Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs

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.

See also

Applies to

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

Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs
Source:
RandomNumberGenerator.cs

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.

See also

Applies to


Feedback

Was this page helpful?