using System.Collections.Generic;
namespace Hallucinate.GameSetup.Maze.Extensions
{
public static class ListExtensions
{
private static System.Random _rng = new System.Random();
///
/// Shuffles a list using the Fisher-Yates algorithm.
///
public static void Shuffle(this IList list)
{
int n = list.Count;
while (n > 1)
{
n--;
int k = _rng.Next(n + 1);
T value = list[k];
list[k] = list[n];
list[n] = value;
}
}
}
}