RandomUtils { public static RandomWrapper getRandom() { RandomWrapper random = new RandomWrapper(); if (testSeed) { random.resetToTestSeed(); } INSTANCES.put(random, Boolean.TRUE); return random; } private  RandomUtils(); static void useTestSeed(); static RandomWrapper getRandom(); static Random getRandom(long seed); static int hashDouble(double value); static int hashFloat(float value); static int nextTwinPrime(int n); static final int MAX_INT_SMALLER_TWIN_PRIME; }
@Test public void testSetSeed() { Random rTest0 = RandomUtils.getRandom(); Random rTest1 = RandomUtils.getRandom(); Random r0 = RandomUtils.getRandom(0); Random r1 = RandomUtils.getRandom(1); long lTest0 = rTest0.nextLong(); long lTest1 = rTest1.nextLong(); long l0 = r0.nextLong(); long l1 = r1.nextLong(); assertEquals("getRandom() must match getRandom() in unit tests", lTest0, lTest1); assertTrue("getRandom() must differ from getRandom(0)", lTest0 != l1); assertTrue("getRandom(0) must differ from getRandom(1)", l0 != l1); }