}
public void testNextIntDistribution() {
for (int seed : NUMBERS) {
for (int bound : new int[]{ 2, 3, 4, 7, 16, 33 }) {
RandomProvider rp = RandomProviderImpl.ofSeed(seed);
int counts[] = new int[bound];
for (int i = 0; i < ITERATIONS; i++) {
counts[rp.nextInt(bound)]++; // fails with index-out-of-range if nextInt goes wrong
}
for (int j = 0; j < bound; j++) {
assertTrue("seed " + seed + ", bound " + bound + ", index " + j + ", count " + counts[j],
counts[j] >= (1.0 - MAX_DEVIATION) / bound * ITERATIONS);
assertTrue("seed " + seed + ", bound " + bound + ", index " + j + ", count " + counts[j],