/// <summary> /// Draw a random boolean with equal probability of true or false. /// </summary> public sealed override byte Byte() { byte b; if (IsAvailableByte()) { lock (Queue) { b = Queue.Dequeue(); } } else { b = RandFallback.Byte(); } return(b); }
/// <summary> /// Draw an array of random and uniform bytes. /// </summary> /// <param name="length">The array length requested.</param> public sealed override byte[] Bytes(int length) { byte[] arr; if (IsAvailableBytes(length)) { arr = new byte[length]; lock (Queue) { for (int i = 0; i < length; i++) { arr[i] = Queue.Dequeue(); } } } else { arr = RandFallback.Bytes(length); } return(arr); }