BinomialDistributionTest testInstance = new BinomialDistributionTest("");
int[] densityPoints = testInstance.makeDensityTestPoints();
double[] densityValues = testInstance.makeDensityTestValues();
int sampleSize = 1000;
int length = TestUtils.eliminateZeroMassPoints(densityPoints, densityValues);
BinomialDistributionImpl distribution = (BinomialDistributionImpl) testInstance.makeDistribution();
double[] expectedCounts = new double[length];
long[] observedCounts = new long[length];
for (int i = 0; i < length; i++) {
expectedCounts[i] = sampleSize * densityValues[i];
}
randomData.reSeed(1000);
for (int i = 0; i < sampleSize; i++) {
int value = randomData.nextBinomial(distribution.getNumberOfTrials(),
distribution.getProbabilityOfSuccess());
for (int j = 0; j < length; j++) {
if (value == densityPoints[j]) {
observedCounts[j]++;
}
}