public void AccurateRandom_Next2() { var rng0 = new AccurateRandom(new ConstRandom(0)); Assert.AreEqual(-1, rng0.Next(-1, 1)); Assert.AreEqual(int.MinValue, rng0.Next(int.MinValue, int.MaxValue)); var rng1 = new AccurateRandom(new ConstRandom(uint.MaxValue)); Assert.AreEqual(0, rng1.Next(-1, 1)); Assert.AreEqual(0x3FFFFFFF + int.MinValue, rng1.Next(int.MinValue, (int)(0x40000000L + int.MinValue))); }
public void AccurateRandom_Next1() { var rng0 = new AccurateRandom(new ConstRandom(0)); Assert.AreEqual(0, rng0.Next(1)); Assert.AreEqual(0, rng0.Next(3)); Assert.AreEqual(0, rng0.Next(7)); Assert.AreEqual(0, rng0.Next(17)); var rng1 = new AccurateRandom(new ConstRandom(uint.MaxValue)); Assert.AreEqual(0, rng1.Next(1)); Assert.AreEqual(7, rng1.Next(8)); Assert.AreEqual(31, rng1.Next(32)); Assert.AreEqual(0x3FFFFFFF, rng1.Next(0x40000000)); }
public void AccurateRandom_Next0() { var rng0 = new AccurateRandom(new ConstRandom(0)); Assert.AreEqual(0, rng0.Next()); var rng1 = new AccurateRandom(new ConstRandom(uint.MaxValue - 1)); Assert.AreEqual(int.MaxValue - 1, rng1.Next()); }