public static T[][] GetSimpleCombinations <T>(this ICollection <T> collection, int numberOfElementsPerCombination) { T[][] result = new T[NumberOfSimpleCombinations(numberOfElementsPerCombination, collection)][]; int index = 0; Loops.ForCombo <T>(numberOfElementsPerCombination, collection, (T[] a) => { result[index] = a; index++; }, false, false); return(result); }
public static T[][] GetPermutationsWithReplacement <T>(this ICollection <T> collection, int numberOfElementsPerCombination) { T[][] result = new T[NumberOfPermutationsWithReplacement <T>(numberOfElementsPerCombination, collection)][]; int index = 0; Loops.ForCombo <T>(numberOfElementsPerCombination, collection, (T[] a) => { result[index] = a; index++; }, false, true); return(result); }