using System.Collections.Generic;
var random = new Random();
var array = new [] { 1, 2, 3 };
foreach (var item in array) {
public static class ListExtensions
public static void Shuffle<T>(this IList<T> list, Random random)
for (var i = list.Count - 1; i > 0; i--)
int indexToSwap = random.Next(i + 1);
(list[indexToSwap], list[i]) = (list[i], list[indexToSwap]);