### Question:
Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } private  Fortuna(Generator generator, Pool[] pools); static Fortuna createInstance(); static Fortuna createInstance(Iterable<EntropySource> sources); @Override synchronized void setSeed(long seed);  }### Answer:
@Test public void shouldCreateInstanceAndWaitForInitialization() throws Exception { Fortuna fortuna = Fortuna.createInstance(); try { fortuna.nextInt(42); } catch (IllegalStateException ignored) { fail("Did not wait for initialization"); } }
@Ignore @Test public void shouldProduceEvenDistribution() throws Exception { int[] numbers = new int[10]; Fortuna fortuna = Fortuna.createInstance(); for (int i = 0; i < 1000000; i++) { numbers[fortuna.nextInt(10)]++; } int lowest = Integer.MAX_VALUE; int highest = Integer.MIN_VALUE; for (int number : numbers) { if (number > highest) { highest = number; } if (number < lowest) { lowest = number; } } System.out.println("numbers = " + Arrays.toString(numbers)); int percentage = (100 * (highest - lowest)) / lowest; System.out.println("percentage = " + percentage); assertEquals(0, percentage); }