@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); }
public static Fortuna createInstance() { return createInstance(defaultSources()); }
Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } }
Fortuna extends Random { public static Fortuna createInstance() { return createInstance(defaultSources()); } private  Fortuna(Generator generator, Pool[] pools); }
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); }
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);  }