private void normalize(ProbabilityDistribution dist, Rank modified) throws Exception {
        double total = 0;

        for (Rank r : Rank.values()) {
            if (r != modified) {
                total += dist.getProb(r);
            }
        }
        if (Math.abs(total) < EPSILON) {
            return;
        }

        double scale = (1 - dist.getProb(modified)) / total;

        for (Rank r : Rank.values()) {
            if (r != modified) {
                dist.setProb(r, scale * dist.getProb(r));
            }
        }

        total = 0;
        for (Rank r : Rank.values()) {
            total += dist.getProb(r);
        }
        if (Math.abs(total - 1) > EPSILON) {
            throw new IllegalStateException("normilization falure " + total);
        }
    }