public static void main(String[] args) {
        System.out.println("Unique count; Average estimated unique count; Normalized standard error; Standard error; Min; Max");
        for (int val = 1; val <= MAX_VAL; val *= 2) {
            List<Long> samples = new ArrayList<>();
            long sumEstimates = 0;
            for (int iteration = 0; iteration < MAX_ITERATION; iteration++) {
                long sample = estimateUniqueCount(val);
                samples.add(sample);
                sumEstimates += sample;
            }
            double average = sumEstimates / (double) MAX_ITERATION;
            long min = samples.stream().min(Long::compare).get();
            long max = samples.stream().max(Long::compare).get();
            double standardDeviation = getStandardDeviation(samples, average);
            System.out.printf("%d; %.2f; %.4f; %.4f; %d; %d\n", val, average, standardDeviation / average, standardDeviation, min, max);
        }
    }
This benchmarks performs a series of unique counting tests to analyse the HyperLogLog accuracy.
searchlib/src/test/java/com/yahoo/searchlib/aggregation/hll/HyperLogLogPrecisionBenchmark.java