Esempio n. 1
0
        public static KeyValuePair <string, string> GenerateQuestionAndAnswer(
            IRandomNumberGenerator randomNumberGenerator, Rank rankToUse)
        {
            var numberRange = GetNumberRange(rankToUse);
            var minValue    = -numberRange;
            var maxValue    = numberRange + 1;
            var firstItem   = randomNumberGenerator.GetNumber(minValue, maxValue);
            var secondItem  = randomNumberGenerator.GetNumber(minValue, maxValue);
            var answerItem  = firstItem + secondItem;

            var equationWithoutAnswer = $"{firstItem} + {secondItem} = ?";
            var equationWithAnswer    = $"{firstItem} + {secondItem} = {answerItem}";

            return(new KeyValuePair <string, string>(equationWithoutAnswer, equationWithAnswer));
        }
Esempio n. 2
0
 public Region RandomRegion(IRandomNumberGenerator randomNumberGenerator)
 {
     return(_regions[randomNumberGenerator.GetNumber(_regions.Count)]);
 }