AbstractIntegerDistribution implements IntegerDistribution, Serializable { public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException { if (x1 < x0) { throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT, x0, x1, true); } return cumulativeProbability(x1) - cumulativeProbability(x0); } @Deprecated protected  AbstractIntegerDistribution(); protected  AbstractIntegerDistribution(RandomGenerator rng); double cumulativeProbability(int x0, int x1); int inverseCumulativeProbability(final double p); void reseedRandomGenerator(long seed); int sample(); int[] sample(int sampleSize); double logProbability(int x);  }
@Test public void testCumulativeProbabilitiesSingleArguments() { for (int i = 1; i < 7; i++) { Assert.assertEquals(p * i, diceDistribution.cumulativeProbability(i), Double.MIN_VALUE); } Assert.assertEquals(0.0, diceDistribution.cumulativeProbability(0), Double.MIN_VALUE); Assert.assertEquals(1.0, diceDistribution.cumulativeProbability(7), Double.MIN_VALUE); }
@Test public void testCumulativeProbabilitiesRangeArguments() { int lower = 0; int upper = 6; for (int i = 0; i < 2; i++) { Assert.assertEquals(1 - p * 2 * i, diceDistribution.cumulativeProbability(lower, upper), 1E-12); lower++; upper--; } for (int i = 0; i < 6; i++) { Assert.assertEquals(p, diceDistribution.cumulativeProbability(i, i+1), 1E-12); } }