Random Extensions.Shuffle<T> Method
Performs an in-place shuffle of an array.
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.5.0
C#
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.5.0
public static void Shuffle<T>(
this Random random,
IList<T> values
)
Parameters
Type Parameters
- T
- The type of the elements of the array.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Random. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Remarks
This method uses Next(Int32, Int32)
to choose values for shuffling. This method is an O(n) operation.