Shuffler.Shuffle Method

Definition

Namespace: Numerics.NET.Random
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.0

Overload List

Shuffle<T>(IList<T>) Puts the members of a collection in random order.
Shuffle<T>(T[]) Puts the members of an array in random order.
Shuffle<T>(Span<T>) Puts the elements of a span in random order.
Shuffle<T>(IList<T>, Random) Puts the members of a collection in a random order.
Shuffle<T>(T[], Random) Puts the members of an array in a random order.
Shuffle<T>(Span<T>, Random) Puts the elements of a span in a random order.
Shuffle<T>(IList<T>, Int32, Int32, Random) Puts the members of a collection in a random order.
Shuffle<T>(T[], Int32, Int32, Random) Puts the members of an array 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> array
)

Parameters

array  IList<T>
The array to shuffle.

Type Parameters

T

Remarks

This function makes a array of the n numbers from min to min+n-1 in random order. The parameter array 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 array as an index into a table of the items you want to shuffle.

Exceptions

ArgumentNullException

array is null.

Shuffle<T>(T[])

Puts the members of an array in random order.
C#
public static void Shuffle<T>(
	T[] array
)

Parameters

array  T[]
The array to shuffle.

Type Parameters

T

Remarks

This function makes a array of the n numbers from min to min+n-1 in random order. The parameter array 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 array as an index into a table of the items you want to shuffle.

Exceptions

ArgumentNullException

array is null.

Shuffle<T>(Span<T>)

Puts the elements of a span in random order.
C#
public static void Shuffle<T>(
	Span<T> span
)

Parameters

span  Span<T>
The array to shuffle.

Type Parameters

T

Remarks

This function makes a array of the n numbers from min to min+n-1 in random order. The parameter span 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 array as an index into a table of the items you want to shuffle.

Exceptions

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

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

Parameters

array  IList<T>
The array 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 array of the n numbers from min to min+n-1 in random order. The parameter 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 array as an index into a table of the items you want to shuffle.

Exceptions

ArgumentNullException

array is null.

-or-

random is null.

Shuffle<T>(T[], Random)

Puts the members of an array in a random order.
C#
public static void Shuffle<T>(
	T[] array,
	Random random
)

Parameters

array  T[]
The array 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 array of the n numbers from min to min+n-1 in random order. The parameter 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 array as an index into a table of the items you want to shuffle.

Exceptions

ArgumentNullException

array is null.

-or-

random is null.

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

Puts the elements of a span in a random order.
C#
public static void Shuffle<T>(
	Span<T> span,
	Random random
)

Parameters

span  Span<T>
The array 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 array of the n numbers from min to min+n-1 in random order. The parameter 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 array as an index into a table of the items you want to shuffle.

Exceptions

ArgumentNullException

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> array,
	int startIndex,
	int length,
	Random random
)

Parameters

array  IList<T>
The array 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 array of the n numbers from min to min+n-1 in random order. The parameter 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 array as an index into a table of the items you want to shuffle.

Exceptions

ArgumentNullException

array is null.

-or-

random is null.

Shuffle<T>(T[], Int32, Int32, Random)

Puts the members of an array in a random order.
C#
public static void Shuffle<T>(
	T[] array,
	int startIndex,
	int length,
	Random random
)

Parameters

array  T[]
The array 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 array of the n numbers from min to min+n-1 in random order. The parameter 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 array as an index into a table of the items you want to shuffle.

Exceptions

ArgumentNullException

array is null.

-or-

random is null.

See Also