Shuffler.Shuffle Method

Definition

Namespace: Extreme.Mathematics.Random
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

Overload List

Shuffle<T>(IList<T>) Puts the members of a collection in random order.
Shuffle<T>(IList<T>, Random) Puts the members of a collection in a random order.
Shuffle<T>(IList<T>, Int32, Int32, Random) Puts the members of a collection in a random order.

Shuffle<T>(IList<T>)

Puts the members of a collection in random order.
C#
public static void Shuffle<T>(
	IList<T> list
)

Parameters

list  IList<T>
The list to shuffle.

Type Parameters

T

Remarks

This function makes a list of the n numbers from min to min+n-1 in random order. The parameter list must be an array with at least n elements. The array index goes from 0 to n-1. If you want to shuffle something else than integers then use the integers in list as an index into a table of the items you want to shuffle.

Exceptions

ArgumentNullExceptionlist is null.

Shuffle<T>(IList<T>, Random)

Puts the members of a collection in a random order.
C#
public static void Shuffle<T>(
	IList<T> list,
	Random random
)

Parameters

list  IList<T>
The list to shuffle.
random  Random
A Random derived random number generator that is used to generate the random sequence.

Type Parameters

T

Remarks

This function makes a list of the n numbers from min to min+n-1 in random order. The parameter 'this.list' must be an array with at least n elements. The array index goes from 0 to n-1. If you want to shuffle something else than integers then use the integers in list as an index into a table of the items you want to shuffle.

Exceptions

ArgumentNullExceptionlist is null.

-or-

random is null.

Shuffle<T>(IList<T>, Int32, Int32, Random)

Puts the members of a collection in a random order.
C#
public static void Shuffle<T>(
	IList<T> list,
	int startIndex,
	int length,
	Random random
)

Parameters

list  IList<T>
The list to shuffle.
startIndex  Int32
The index of the first member that should be shuffled.
length  Int32
The number of members that should be shuffled.
random  Random
A Random derived random number generator that is used to generate the random sequence.

Type Parameters

T

Remarks

This function makes a list of the n numbers from min to min+n-1 in random order. The parameter 'this.list' must be an array with at least n elements. The array index goes from 0 to n-1. If you want to shuffle something else than integers then use the integers in list as an index into a table of the items you want to shuffle.

Exceptions

ArgumentNullExceptionlist is null.

-or-

random is null.

See Also