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());
        }
        public void AccurateRandom_NextDouble()
        {
            var rng0 = new AccurateRandom(new ConstRandom(0));

            Assert.AreEqual(0, rng0.NextDouble());
            var rng1 = new AccurateRandom(new ConstRandom(uint.MaxValue));

            Assert.AreEqual(BitConverter.Int64BitsToDouble(0x3FEFFFFFFFFFFFFFL), rng1.NextDouble());
        }
        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_FullPrecisionDouble_c0o1()
        {
            Random bits;

            bits = new ConstRandom(1, 0, 0, 0);
            Assert.AreEqual(BitConverter.Int64BitsToDouble(0x3FE0000000000000L), AccurateRandom.FullPrecisionDouble_c0o1(bits));
            bits = new ConstRandom(1, 0, 0xFFFFFFFF, 0xFFFFFFFF);
            Assert.IsTrue(1 > AccurateRandom.FullPrecisionDouble_c0o1(bits));
            Assert.AreEqual(BitConverter.Int64BitsToDouble(0x3FEFFFFFFFFFFFFFL), AccurateRandom.FullPrecisionDouble_c0o1(bits));
            bits = new ConstRandom(Enumerable.Repeat(0U, 30).Append(0U, 0x80000000U, 0U, 0U).ToArray());
            Assert.AreEqual(BitConverter.Int64BitsToDouble(0x0000000000000000), AccurateRandom.FullPrecisionDouble_c0o1(bits));
            bits = new ConstRandom(Enumerable.Repeat(0U, 30).Append(0U, 0x40000000U, 0U, 0U).ToArray());
            Assert.AreEqual(BitConverter.Int64BitsToDouble(0x0000000000000000), AccurateRandom.FullPrecisionDouble_c0o1(bits));
            bits = new ConstRandom(Enumerable.Repeat(0U, 30).Append(0U, 0x40000000U, 0xFFFFFFFFU, 0xFFFFFFFFU).ToArray());
            Assert.IsTrue(0 < AccurateRandom.FullPrecisionDouble_c0o1(bits));
            Assert.AreEqual(BitConverter.Int64BitsToDouble((1L << 52) - 1), AccurateRandom.FullPrecisionDouble_c0o1(bits));
        }