public void inverse_cdf()
        {
            // Consider the following hazard rates, occurring at the given time steps
            double[] times = { 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 17, 20, 21 };

            double[] hazards =
            {
                0,                  0.111111111111111, 0.0625, 0.0714285714285714, 0.0769230769230769,
                0,                 0.0909090909090909,      0,  0.111111111111111,              0.125,0,
                0.166666666666667,                0.2,      0,                0.5, 0
            };

            var distribution = new EmpiricalHazardDistribution(times, hazards);

            Assert.AreEqual(0, distribution.Support.Min);
            Assert.AreEqual(22, distribution.Support.Max);

            Assert.AreEqual(0, distribution.InverseDistributionFunction(0));
            Assert.AreEqual(22, distribution.InverseDistributionFunction(1));
            Assert.AreEqual(22, distribution.InverseDistributionFunction(0.999));

            Assert.AreEqual(0, distribution.DistributionFunction(0));
            Assert.AreEqual(0.1051606831856301d, distribution.DistributionFunction(1));
            Assert.AreEqual(0.1593762566654946d, distribution.DistributionFunction(2));
            Assert.AreEqual(0.78033456236530996d, distribution.DistributionFunction(20));

            Assert.AreEqual(0.78033456236530996d, distribution.DistributionFunction(21));
            Assert.AreEqual(0.78033456236530996d, distribution.InnerDistributionFunction(21));

            Assert.AreEqual(1.0, distribution.DistributionFunction(22));
            Assert.AreEqual(1.0, distribution.InnerDistributionFunction(22));

            Assert.AreEqual(1.0, distribution.InnerDistributionFunction(23));
            Assert.AreEqual(1.0, distribution.InnerDistributionFunction(24));
            Assert.AreEqual(1.0, distribution.DistributionFunction(22));

            double[] percentiles = Vector.Interval(0.0, 1.0, stepSize: 0.1);

            for (int i = 0; i < percentiles.Length; i++)
            {
                double p    = percentiles[i];
                double icdf = distribution.InverseDistributionFunction(p);
                double cdf  = distribution.DistributionFunction(icdf);
                Assert.AreEqual(cdf, p, 0.1);
            }
        }