void (File root, FileFilter filter, int iterationCount, PrintStream out) { /* Typical output: Roulette wheel generator: #10000: sum = 5281 [1: 3770 | 2: 767 | 3: 272 | 4..5: 232 | 6..10: 146 | 11..20: 67 | 21..30: 12 | 31..50: 12 | 51..100: 3 | 101..200: 0 | 201+: 0] Plain generator: #10000: sum = 2504 [1: 1478 | 2: 391 | 3: 159 | 4..5: 155 | 6..10: 156 | 11..20: 103 | 21..30: 22 | 31..50: 8 | 51..100: 22 | 101..200: 9 | 201+: 1] */ for (boolean roulette : new boolean[]{true, false}) { out.println("Testing " + (roulette ? "roulette" : "plain") + " generator"); ObjectIntMap<String> fileMap = new ObjectIntHashMap<>(); Generator<File> generator = randomFiles(root.getPath(), filter, roulette); MadTestingAction action = env -> { long lastTime = System.nanoTime(), startTime = lastTime; for (int iteration = 1; iteration <= iterationCount; iteration++) { File file = env.generateValue(generator, null); assert filter.accept(file); fileMap.put(file.getPath(), fileMap.getOrDefault(file.getPath(), 0)+1); long curTime = System.nanoTime(); if (iteration <= 10) { out.print("#" + iteration + " = " + (curTime - lastTime) / 1_000_000 + "ms"); if (iteration == 10) { out.println(); } else { out.print("; "); } lastTime = curTime; } if (iteration == iterationCount || curTime - lastTime > TimeUnit.SECONDS.toNanos(5)) { lastTime = curTime; out.println(getHistogramReport(fileMap, iteration)); } } out.println("Total time: " + (System.nanoTime() - startTime) / 1_000_000 + "ms"); }; PropertyChecker.customized().withIterationCount(1).checkScenarios(() -> action); } }