public void ConstructorTest()
        {
            // Create a new Poisson distribution with 
            var dist = new PoissonDistribution(lambda: 4.2);

            // Common measures
            double mean = dist.Mean;     // 4.2
            double median = dist.Median; // 4.0
            double var = dist.Variance;  // 4.2

            // Cumulative distribution functions
            double cdf1 = dist.DistributionFunction(k: 2); // 0.21023798702309743
            double cdf2 = dist.DistributionFunction(k: 4); // 0.58982702131057763
            double cdf3 = dist.DistributionFunction(k: 7); // 0.93605666027257894
            double ccdf = dist.ComplementaryDistributionFunction(k: 2); // 0.78976201297690252

            // Probability mass functions
            double pmf1 = dist.ProbabilityMassFunction(k: 4); // 0.19442365170822165
            double pmf2 = dist.ProbabilityMassFunction(k: 5); // 0.1633158674349062
            double pmf3 = dist.ProbabilityMassFunction(k: 6); // 0.11432110720443435
            double lpmf = dist.LogProbabilityMassFunction(k: 2); // -2.0229781299813

            // Quantile function
            int icdf1 = dist.InverseDistributionFunction(p: cdf1); // 2
            int icdf2 = dist.InverseDistributionFunction(p: cdf2); // 4
            int icdf3 = dist.InverseDistributionFunction(p: cdf3); // 7

            // Hazard (failure rate) functions
            double hf = dist.HazardFunction(x: 4); // 0.47400404660843515
            double chf = dist.CumulativeHazardFunction(x: 4); // 0.89117630901575073

            // String representation
            string str = dist.ToString(CultureInfo.InvariantCulture); // "Poisson(x; λ = 4.2)"


            // Median bounds
            // (http://en.wikipedia.org/wiki/Poisson_distribution#Median)

            double max = 4.2 + 1 / 3.0;
            double min = 4.2 - System.Math.Log(2);
            Assert.IsTrue(median < max);
            Assert.IsTrue(min <= median);

            Assert.AreEqual(4.2, mean);
            Assert.AreEqual(4.0, median);
            Assert.AreEqual(4.2, var);
            Assert.AreEqual(0.89117630901575073, chf, 1e-10);
            Assert.AreEqual(0.21023798702309743, cdf1);
            Assert.AreEqual(0.58982702131057763, cdf2);
            Assert.AreEqual(0.93605666027257894, cdf3);
            Assert.AreEqual(0.19442365170822165, pmf1);
            Assert.AreEqual(0.1633158674349062, pmf2);
            Assert.AreEqual(0.11432110720443435, pmf3);
            Assert.AreEqual(-2.0229781299813, lpmf);
            Assert.AreEqual(0.47400404660843515, hf);
            Assert.AreEqual(0.89117630901575073, chf);
            Assert.AreEqual(0.78976201297690252, ccdf);
            Assert.AreEqual(2, icdf1);
            Assert.AreEqual(4, icdf2);
            Assert.AreEqual(7, icdf3);
            Assert.AreEqual("Poisson(x; λ = 4.2)", str);

            var range1 = dist.GetRange(0.95);
            var range2 = dist.GetRange(0.99);
            var range3 = dist.GetRange(0.01);

            Assert.AreEqual(1, range1.Min);
            Assert.AreEqual(8, range1.Max);
            Assert.AreEqual(0, range2.Min);
            Assert.AreEqual(10, range2.Max);
            Assert.AreEqual(0, range3.Min);
            Assert.AreEqual(10, range3.Max);
        }