public static T[] Shuffle <T>(this IEnumerable <T> enumerable) { T[] arr = enumerable.ToArray(); for (int i = arr.Length - 1; i >= 0; i--) { int j = RandomAid.NextInt(i + 1); T temp = arr[j]; arr[j] = arr[i]; arr[i] = temp; } return(arr); }
private static int Partition <T>(this IList <T> list, Func <T, T, int> comparison, IntRange indices) { return(list.Partition(RandomAid.NextInt(indices), comparison, indices)); }