public static Byte NextByte(this Random random, Byte lowerBound, Byte upperBound) { lowerBound.ThrowIfStrictlyGreaterThan(upperBound, nameof(lowerBound)); var value = (Byte)(random.NextByte() % (upperBound + 1 - lowerBound) + lowerBound); return value; }