public static Fraction[] GetRandomPairs(int quantity, int maxDenom, bool includeZero, bool includeTotal) { List<Fraction> result = new List<Fraction>(); Randomizer denominators = Randomizer.New(maxDenom, 3).ExcludeNumbers(new List<int> {7, 11}); while(result.Count < quantity * 2) { int denominator = denominators.Next(); Randomizer numerators = Randomizer.New(includeTotal ? denominator : (denominator - 1), includeZero ? 0 : 1, false); bool roundDone = false; while(!roundDone && numerators.HasNext()){ int numerator = numerators.Next(); Fraction f = new Fraction(numerator, denominator); Fraction eq = new Fraction(f.Numerator, f.Denominator).RandomEquivalent(maxDenom); if(!f.LiteralEquals(eq) && !result.Contains(f)){ result.Add(f); result.Add(eq); roundDone = true; } } } return result.ToArray(); }