@Test public void testBoolean() { for (long seed = 0; seed < 10000; seed++) { CopiableRandom myrand = new CopiableRandom(seed); Random rand = new Random(seed); for (int i = 1; i < 1000; i++) { myrand = new CopiableRandom(myrand); boolean a = rand.nextBoolean(); boolean b = myrand.nextBoolean(); assertTrue(a == b); } } }
@Test public void testInt() { for (long seed = 0; seed < 10000; seed++) { Random rand = new Random(seed); CopiableRandom myrand = new CopiableRandom(seed); for (int i = 1; i < 1000; i++) { // copy constructor myrand = new CopiableRandom(myrand); assertTrue(rand.nextBoolean() == myrand.nextBoolean()); } myrand = new CopiableRandom(seed); rand = new Random(seed); for (int i = 1; i < 1000; i++) { myrand = new CopiableRandom(myrand); int a = rand.nextInt(1000000); int b = myrand.nextInt(1000000); assertTrue(a == b); // System.out.println("Equals the two " + (a==b) +" "+a+" "+b); } } }