int buckets[] = new int[bucketCount];
long n = max - min;
Random rng = initRandom("testCDFChooseConsistency");
ProbabilityDistribution dist = getDist();
dist.init(min, max, getDistParams(), "");
int trials = 1000000;
for (int i = 0; i < trials; i++) {
long id = dist.choose(rng);
long off = id - min;
int bucket = bucketer.chooseBucket(off, n);
buckets[bucket]++;
}
int totalCount = 0;
boolean fail = false;
for (int b = 0; b < bucketCount; b++) {
totalCount += buckets[b];
long bucketTop = bucketer.bucketMax(b, n) + min;
double actCDF = ((double)totalCount) / trials;
double expCDF = dist.cdf(bucketTop);
// 0.2% error
if (Math.abs(expCDF - actCDF) > tolerance()) {
System.err.println(String.format("Divergence between CDF and " +
"choose function: P(X <= %d) act: %f exp: %f", bucketTop,
actCDF, expCDF));