;
}
if (hexString.length() != 1) {
fail("incorrect length for generated string");
}
Frequency f = new Frequency();
for (int i = 0; i < smallSampleSize; i++) {
hexString = randomData.nextSecureHexString(100);
if (hexString.length() != 100) {
fail("incorrect length for generated string");
}
for (int j = 0; j < hexString.length(); j++) {
f.addValue(hexString.substring(j,j+1));
}
}
double[] expected = new double[16];
long[] observed = new long[16];
for (int i = 0; i < 16; i++) {
expected[i] = (double)smallSampleSize*100/(double)16;
observed[i] = f.getCount(hex[i]);
}
/* Use ChiSquare dist with df = 16-1 = 15, alpha = .001
* Change to 30.58 for alpha = .01
*/
assertTrue("chi-square test -- will fail about 1 in 1000 times",