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); }
public void TestInt() { var rnd = new LinearCongruentialRandom(1); foreach (int aIntTest in IntTest) { int g = rnd.NextInt(); Assert.AreEqual(g, aIntTest, AIFH.DefaultPrecision); } }
public void TestIntRange() { var rnd = new LinearCongruentialRandom(1); foreach (int aIntRangeTest in IntRangeTest) { int g = rnd.NextInt(0, 10); Assert.AreEqual(g, aIntRangeTest); } }
public void TestGaussianFloat() { var rnd = new LinearCongruentialRandom(1); foreach (double aGaussianTest in GaussianTest) { double g = rnd.NextGaussian(); Assert.AreEqual(g, aGaussianTest, AIFH.DefaultPrecision); } }
public void TestFloat() { var rnd = new LinearCongruentialRandom(1); foreach (float aFloatTest in FloatTest) { var l = (float)rnd.NextFloat(); Assert.AreEqual(l, aFloatTest, AIFH.DefaultPrecision); } }
public void TestLong() { var rnd = new LinearCongruentialRandom(1); foreach (long aLongTest in LongTest) { long l = rnd.NextLong(); Assert.AreEqual(l, aLongTest, AIFH.DefaultPrecision); } }
public void TestDouble() { var rnd = new LinearCongruentialRandom(1); foreach (double aDoubleTest in DoubleTest) { double g = rnd.NextDouble(); Assert.AreEqual(g, aDoubleTest, AIFH.DefaultPrecision); } }
public void TestGenerateBoolean() { var rnd = new LinearCongruentialRandom(1); foreach (bool aBooleanTest in BooleanTest) { bool g = rnd.NextBoolean(); Assert.AreEqual(g, aBooleanTest); } }