namespace Utils { public static class RandomUtils { private static readonly Random random = new Random(); public static T PickOneRandom(this List remainingItems) { var i = random.Next(0, remainingItems.Count); var result = remainingItems[i]; remainingItems.RemoveAt(i); return result; } public static T[] Shuffled(T[] items) { var result = new List(); var source = items.ToList(); while (source.Any()) { result.Add(RandomUtils.PickOneRandom(source)); } return result.ToArray(); } } }