public int[,] GenerateRandomBingoCardNumbers() { var ng = new BingoNumbersGenerator(); var randomCardNumbers = new[, ] { { ng.GenerateUniqueNumberForLetter(BingoLetter.B), ng.GenerateUniqueNumberForLetter(BingoLetter.I), ng.GenerateUniqueNumberForLetter(BingoLetter.N), ng.GenerateUniqueNumberForLetter(BingoLetter.G), ng.GenerateUniqueNumberForLetter(BingoLetter.O) }, { ng.GenerateUniqueNumberForLetter(BingoLetter.B), ng.GenerateUniqueNumberForLetter(BingoLetter.I), ng.GenerateUniqueNumberForLetter(BingoLetter.N), ng.GenerateUniqueNumberForLetter(BingoLetter.G), ng.GenerateUniqueNumberForLetter(BingoLetter.O) }, { ng.GenerateUniqueNumberForLetter(BingoLetter.B), ng.GenerateUniqueNumberForLetter(BingoLetter.I), ng.GenerateUniqueNumberForLetter(BingoLetter.N), ng.GenerateUniqueNumberForLetter(BingoLetter.G), ng.GenerateUniqueNumberForLetter(BingoLetter.O) }, { ng.GenerateUniqueNumberForLetter(BingoLetter.B), ng.GenerateUniqueNumberForLetter(BingoLetter.I), ng.GenerateUniqueNumberForLetter(BingoLetter.N), ng.GenerateUniqueNumberForLetter(BingoLetter.G), ng.GenerateUniqueNumberForLetter(BingoLetter.O) }, { ng.GenerateUniqueNumberForLetter(BingoLetter.B), ng.GenerateUniqueNumberForLetter(BingoLetter.I), ng.GenerateUniqueNumberForLetter(BingoLetter.N), ng.GenerateUniqueNumberForLetter(BingoLetter.G), ng.GenerateUniqueNumberForLetter(BingoLetter.O) } }; return(randomCardNumbers); }
public BingoBall GenerateRandomBingoBall() { if (!CanGenerateBalls()) { throw new Exception("All balls were already generated"); } var randomLetter = GenerateRandomBingoLetter(); if (!_numbersGenerator.CanGenerateNumberForLetter(randomLetter)) { return(GenerateRandomBingoBall()); } var randomNumber = _numbersGenerator.GenerateUniqueNumberForLetter(randomLetter); return(new BingoBall(randomLetter, randomNumber)); }