Note

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

Access to this page requires authorization. You can try .

Random.Shuffle Method

Definition

Namespace:
System
Assemblies:
netstandard.dll, System.Runtime.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
Shuffle<T>(Span<T>)

Performs an in-place shuffle of a span.

Shuffle<T>(T[])

Performs an in-place shuffle of an array.

Shuffle<T>(Span<T>)

Source:
Random.cs
Source:
Random.cs
Source:
Random.cs
Source:
Random.cs

Performs an in-place shuffle of a span.

public:
generic <typename T>
 void Shuffle(Span<T> values);
public void Shuffle<T>(Span<T> values);
member this.Shuffle : Span<'T> -> unit
Public Sub Shuffle(Of T) (values As Span(Of T))

Type Parameters

T

The type of span.

Parameters

values
Span<T>

The span to shuffle.

Remarks

This method uses Next(Int32, Int32) to choose values for shuffling. This method is an O(n) operation.

Applies to

Shuffle<T>(T[])

Source:
Random.cs
Source:
Random.cs
Source:
Random.cs
Source:
Random.cs

Performs an in-place shuffle of an array.

public:
generic <typename T>
 void Shuffle(cli::array <T> ^ values);
public void Shuffle<T>(T[] values);
member this.Shuffle : 'T[] -> unit
Public Sub Shuffle(Of T) (values As T())

Type Parameters

T

The type of array.

Parameters

values
T[]

The array to shuffle.

Exceptions

values is null.

Remarks

This method uses Next(Int32, Int32) to choose values for shuffling. This method is an O(n) operation.

Applies to


Feedback

Was this page helpful?