@Override
    public double cdf(double k) {
        if (k < 0) {
            return 0.0;
        } else {
            return 1 - Math.pow(1 - p, k);
        }
    }
@Test
    public void testCdf() {
        System.out.println("cdf");
        ShiftedGeometricDistribution instance = new ShiftedGeometricDistribution(0.3);
        instance.rand();
        assertEquals(0.3, instance.cdf(1), 1E-6);
        assertEquals(0.51, instance.cdf(2), 1E-6);
        assertEquals(0.657, instance.cdf(3), 1E-6);
        assertEquals(0.7599, instance.cdf(4), 1E-6);
        assertEquals(0.83193, instance.cdf(5), 1E-6);
        assertEquals(0.9802267, instance.cdf(11), 1E-6);
        assertEquals(0.9994415, instance.cdf(21), 1E-6);
    }