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
Povratne informacije
https://aka.ms/ContentUserFeedback.
Kmalu na voljo: V letu 2024 bomo ukinili storitev Težave v storitvi GitHub kot mehanizem za povratne informacije za vsebino in jo zamenjali z novim sistemom za povratne informacije. Za več informacij si oglejte:Pošlji in prikaži povratne informacije za