MersenneTwister extends RandomEngine { @Override public Object clone() { MersenneTwister clone = (MersenneTwister) super.clone(); clone.mt = this.mt.clone(); return clone; } MersenneTwister();  MersenneTwister(int seed);  MersenneTwister(Date d); @Override Object clone(); @Override int nextInt();  }
@Test public void testClone() { MersenneTwister r1 = new MersenneTwister(1275264362); MersenneTwister r2 = (MersenneTwister) r1.clone(); int x = r1.nextInt(); int y = r2.nextInt(); Assert.assertEquals(x, y); Assert.assertFalse(r1.nextInt() == y); Assert.assertFalse(r1.nextInt() == r2.nextInt()); r2.nextInt(); for (int i = 0; i < 100; i++) { Assert.assertEquals("date-"+i, r1.nextInt(), r2.nextInt()); } }