Random random = new Random();
System.out.println("[-100, 100]:");
for (BinScheme scheme : Arrays.asList(new ConstantBinScheme(1000, -100, 100),
new ConstantBinScheme(100, -100, 100),
new ConstantBinScheme(10, -100, 100))) {
Histogram h = new Histogram(scheme);
for (int i = 0; i < 10000; i++)
h.record(200.0 * random.nextDouble() - 100.0);
for (double quantile = 0.0; quantile < 1.0; quantile += 0.05)
System.out.printf("%5.2f: %.1f, ", quantile, h.value(quantile));
System.out.println();
}
System.out.println("[0, 1000]");
for (BinScheme scheme : Arrays.asList(new LinearBinScheme(1000, 1000),
new LinearBinScheme(100, 1000),
new LinearBinScheme(10, 1000))) {
Histogram h = new Histogram(scheme);
for (int i = 0; i < 10000; i++)
h.record(1000.0 * random.nextDouble());
for (double quantile = 0.0; quantile < 1.0; quantile += 0.05)
System.out.printf("%5.2f: %.1f, ", quantile, h.value(quantile));
System.out.println();
}
}