public double getVariance() {
        if (mustRecalcVariance) {
            mustRecalcVariance = false;
            if (n == 0) {
                variance = Double.NaN;
            } else if (n == 1) {
                variance = 0d;
            } else {
                variance = m2 / (n - 1);
            }
        }
        stddev = Double.NaN;
        return variance;
    }
Get the variance of all increments that have been added
@return the variance of all increments that have been added
benchmarks/src/main/java/nl/basjes/statistics/Counter.java