/// <summary> /// Generates next random UInt32 between 0 and maxValue . /// </summary> public static UInt32 NextUInt32(this RNGCryptoServiceProvider rndGen, UInt32 maxValue) { UInt32 genNumber = rndGen.NextUInt32(); while (genNumber == UInt32.MaxValue) { genNumber = rndGen.NextUInt32(); } return((UInt32)((maxValue + 1) * ((double)genNumber / (double)UInt32.MaxValue))); }