for (int i = 0; i < 10; i++) {
quantiles[i] = randomData.nextUniform(0, 1);
}
// Reseed again so the inversion generator gets the same sequence
randomData.reSeed(100);
BetaDistributionImpl betaDistribution = new BetaDistributionImpl(2, 4);
/*
* Generate a sequence of deviates using inversion - the distribution function
* evaluated at the random value from the distribution should match the uniform
* random value used to generate it, which is stored in the quantiles[] array.
*/
for (int i = 0; i < 10; i++) {
double value = randomData.nextInversionDeviate(betaDistribution);
assertEquals(betaDistribution.cumulativeProbability(value), quantiles[i], 10E-9);
}
}