public void UniformTest()
        {
            int a = 2;
            int b = 5;
            int n = b - a + 1;

            // Wikipedia definitions
            double expectedMean = (a + b) / 2.0;
            double expectedVar  = (System.Math.Pow(b - a + 1, 2) - 1) / 12.0;
            double p            = 1.0 / n;


            JointDistribution dist = JointDistribution.Uniform(1, a, b);

            Assert.AreEqual(expectedMean, dist.Mean[0]);
            // Assert.AreEqual(expectedVar, dist.Variance);
            Assert.AreEqual(n, dist.Frequencies.Length);


            Assert.AreEqual(0, dist.ProbabilityMassFunction(new[] { 0 }));
            Assert.AreEqual(0, dist.ProbabilityMassFunction(new[] { 1 }));
            Assert.AreEqual(p, dist.ProbabilityMassFunction(new[] { 2 }));
            Assert.AreEqual(p, dist.ProbabilityMassFunction(new[] { 3 }));
            Assert.AreEqual(p, dist.ProbabilityMassFunction(new[] { 4 }));
            Assert.AreEqual(p, dist.ProbabilityMassFunction(new[] { 5 }));
            Assert.AreEqual(0, dist.ProbabilityMassFunction(new[] { 6 }));
            Assert.AreEqual(0, dist.ProbabilityMassFunction(new[] { 7 }));
        }
        public void ProbabilityMassFunctionTest()
        {
            JointDistribution dist = JointDistribution.Uniform(1, 2, 5);
            double            p    = 0.25;

            Assert.AreEqual(0, dist.ProbabilityMassFunction(new[] { 0 }));
            Assert.AreEqual(0, dist.ProbabilityMassFunction(new[] { 1 }));
            Assert.AreEqual(p, dist.ProbabilityMassFunction(new[] { 2 }));
            Assert.AreEqual(p, dist.ProbabilityMassFunction(new[] { 3 }));
            Assert.AreEqual(p, dist.ProbabilityMassFunction(new[] { 4 }));
            Assert.AreEqual(p, dist.ProbabilityMassFunction(new[] { 5 }));
            Assert.AreEqual(0, dist.ProbabilityMassFunction(new[] { 6 }));
            Assert.AreEqual(0, dist.ProbabilityMassFunction(new[] { 7 }));
        }
        public void LogProbabilityMassFunctionTest()
        {
            JointDistribution dist = JointDistribution.Uniform(1, 2, 5);

            double p = System.Math.Log(0.25);
            double l = System.Math.Log(0);

            Assert.AreEqual(l, dist.LogProbabilityMassFunction(new[] { 0 }));
            Assert.AreEqual(l, dist.LogProbabilityMassFunction(new[] { 1 }));
            Assert.AreEqual(p, dist.LogProbabilityMassFunction(new[] { 2 }));
            Assert.AreEqual(p, dist.LogProbabilityMassFunction(new[] { 3 }));
            Assert.AreEqual(p, dist.LogProbabilityMassFunction(new[] { 4 }));
            Assert.AreEqual(p, dist.LogProbabilityMassFunction(new[] { 5 }));
            Assert.AreEqual(l, dist.LogProbabilityMassFunction(new[] { 6 }));
            Assert.AreEqual(l, dist.LogProbabilityMassFunction(new[] { 7 }));
        }