public void TestRandomDoubles() { var random = new Hatzap.Utilities.Random() { Seed = 1234, Seed2 = 4321 }; var random2 = new Hatzap.Utilities.Random() { Seed = 1234, Seed2 = 4321 }; for (int i = 0; i < preGeneratedDoubles.Length; i++) { var d1 = random.NextDouble(); Debug.WriteLine(Math.Abs(preGeneratedDoubles[i] - d1)); Assert.AreEqual(preGeneratedDoubles[i], d1, 0.0000000000001, "The given doubles should match because they were generated with the same seeds"); var d2 = random2.NextDouble(); Assert.AreEqual(d1, d2, 0.0000000000001, "The given doubles should match because they were generated with the same seeds"); } }
public void TestRandomInts() { var random = new Hatzap.Utilities.Random() { Seed = 1234, Seed2 = 4321 }; var random2 = new Hatzap.Utilities.Random() { Seed = 1234, Seed2 = 4321 }; for (int i = 0; i < preGeneratedInts.Length; i++) { var n1 = random.NextInt(); Assert.AreEqual(preGeneratedInts[i], n1, "The given integers should match because they were generated with the same seeds"); var n2 = random2.NextInt(); Assert.AreEqual(n1, n2, "The given integers should match because they were generated with the same seeds"); } }