Esempio n. 1
0
        public void TestBasic()
        {
            var rnd = new LinearCongruentialRandom();

            Assert.IsNotNull(rnd.Seed);
            Assert.AreEqual(12345, rnd.Increment);
            Assert.AreEqual(4294967296L, rnd.Modulus);
            Assert.AreEqual(1103515245, rnd.Multiplier);
        }
Esempio n. 2
0
        public void TestInt()
        {
            var rnd = new LinearCongruentialRandom(1);

            foreach (int aIntTest in IntTest)
            {
                int g = rnd.NextInt();
                Assert.AreEqual(g, aIntTest, AIFH.DefaultPrecision);
            }
        }
Esempio n. 3
0
        public void TestIntRange()
        {
            var rnd = new LinearCongruentialRandom(1);

            foreach (int aIntRangeTest in IntRangeTest)
            {
                int g = rnd.NextInt(0, 10);
                Assert.AreEqual(g, aIntRangeTest);
            }
        }
Esempio n. 4
0
        public void TestGaussianFloat()
        {
            var rnd = new LinearCongruentialRandom(1);

            foreach (double aGaussianTest in GaussianTest)
            {
                double g = rnd.NextGaussian();
                Assert.AreEqual(g, aGaussianTest, AIFH.DefaultPrecision);
            }
        }
Esempio n. 5
0
        public void TestFloat()
        {
            var rnd = new LinearCongruentialRandom(1);

            foreach (float aFloatTest in FloatTest)
            {
                var l = (float)rnd.NextFloat();
                Assert.AreEqual(l, aFloatTest, AIFH.DefaultPrecision);
            }
        }
Esempio n. 6
0
        public void TestLong()
        {
            var rnd = new LinearCongruentialRandom(1);

            foreach (long aLongTest in LongTest)
            {
                long l = rnd.NextLong();
                Assert.AreEqual(l, aLongTest, AIFH.DefaultPrecision);
            }
        }
Esempio n. 7
0
        public void TestDouble()
        {
            var rnd = new LinearCongruentialRandom(1);

            foreach (double aDoubleTest in DoubleTest)
            {
                double g = rnd.NextDouble();
                Assert.AreEqual(g, aDoubleTest, AIFH.DefaultPrecision);
            }
        }
Esempio n. 8
0
        public void TestGenerateBoolean()
        {
            var rnd = new LinearCongruentialRandom(1);

            foreach (bool aBooleanTest in BooleanTest)
            {
                bool g = rnd.NextBoolean();
                Assert.AreEqual(g, aBooleanTest);
            }
        }