Random.Shuffle Method
Definition
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
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
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
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
https://aka.ms/ContentUserFeedback.
Binnenkort: Gedurende 2024 worden GitHub Issues uitgefaseerd als het feedbackmechanisme voor inhoud. Dit wordt vervangen door een nieuw feedbacksysteem. Ga voor meer informatie naar:Feedback verzenden en bekijken voor