/// <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())); }
/// <summary> /// Loads 1000 new D6 rolls into the queue /// </summary> private void LoadNewD6Rolls() { List <int> rolls = BrikksRandomNumberGenerator.GenerateIntegers(1000, 1, 6); // fallback to good old .net RNG if (rolls.Count == 0) { for (int i = 0; i < 50; i++) { rolls.Add(ThreadSafeRandom.ThisThreadsRandom.Next(1, 6)); } } foreach (var item in rolls) { D6Rolls.Enqueue(item); } }