ListExtensions.Shuffle<T>

Extension Method in ListExtensions

Declaration

public static void Shuffle<T>(this List<T> list)

Description

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

Type Parameters

TThe type of the list.

Parameters

listThe list to shuffle.

Overload

Declaration

public static void Shuffle<T>(this List<T> list, Random rng)

Description

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

Type Parameters

TThe type of the list.

Parameters

listThe list to shuffle.
rngThe random number generator to use.