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

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

            return(roll);
        }
Ejemplo n.º 2
0
        //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);
        }
Ejemplo 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);
        }