Ejemplo n.º 1
0
        /// <summary>
        /// Returns a new dice roll this includes a D4 and a D6 true random roll.
        /// If no more rolls are available we just get more!
        /// </summary>
        /// <returns><seealso cref="BrikksDiceRoll"/></returns>
        public BrikksDiceRoll GetRoll()
        {
            if (D6Rolls.Count == 0)
            {
                LoadNewD6Rolls();
            }
            if (D4Rolls.Count == 0)
            {
                LoadNewD4Rolls();
            }

            return(new BrikksDiceRoll(D6Rolls.Dequeue(), D4Rolls.Dequeue()));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads 1000 new D4 rolls into the queue
        /// </summary>
        private void LoadNewD4Rolls()
        {
            List <int> rolls = BrikksRandomNumberGenerator.GenerateIntegers(1000, 1, 4);

            // fallback to good old .net RNG
            if (rolls.Count == 0)
            {
                for (int i = 0; i < 50; i++)
                {
                    rolls.Add(ThreadSafeRandom.ThisThreadsRandom.Next(1, 4));
                }
            }

            foreach (var item in rolls)
            {
                D4Rolls.Enqueue(item);
            }
        }