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
Athugasemdir
https://aka.ms/ContentUserFeedback.
Væntanlegt: Á árinu 2024 munum við hætta með GitHub-mál sem ábendingaleið fyrir efni og skipta því út fyrir nýtt ábendingakerfi. Frekari upplýsingar er að finna hér:Senda inn og skoða endurgjöf fyrir