Esempio n. 1
0
        public int GetNextRoll(int sides)
        {
            DiceRngValidator.ValidateSides(sides);

            var roll = _random.Next(1, sides);

            return(roll);
        }
        //public int VisitNumber(DiceNotationParser.NumberContext context)
        //{
        //    throw new System.NotImplementedException();
        //}

        private int GetNextRoll(int sides)
        {
            DiceRngValidator.ValidateSides(sides);
            var roll = _diceRng.GetNextRoll(sides);

            _diceRolls.Add(roll);
            return(roll);
        }
Esempio n. 3
0
        public int GetNextRoll(int sides)
        {
            DiceRngValidator.ValidateSides(sides);

            var data = new byte[4];

            _cryptoServiceProvider.GetBytes(data);
            var value = BitConverter.ToInt32(data, 0);

            return((value % sides) + 1);
        }