ArrayExtensions.Shuffle<T>

Extension Method in ArrayExtensions

Declaration

public static void Shuffle<T>(this T[] array)

Description

Shuffles the array in place. The shuffle is done using the Fisher-Yates algorithm.

Type Parameters

TThe type of the array.

Parameters

arrayThe array to shuffle.

Overload

Declaration

public static void Shuffle<T>(this T[] array, Random rng)

Description

Shuffles the array in place using the given random number generator. The shuffle is done using the Fisher-Yates algorithm.

Type Parameters

TThe type of the array.

Parameters

arrayThe array to shuffle.
rngThe random number generator to use.