public void GenerateTest2()
        {
            double lambda = 1.11022302462516E-16;
            var target = new PoissonDistribution(lambda) as ISampleableDistribution<double>;

            double[] values = new double[10000];
            for (int i = 0; i < values.Length; i++)
                values[i] = target.Generate();

            for (int i = 0; i < values.Length; i++)
                Assert.AreEqual(0, values[i]);
        }
        public void RankDistribution()
        {
            // Create a new distribution, such as a Poisson
            var poisson = new PoissonDistribution(lambda: 0.42);

            // Draw enough samples from it
            double[] samples = poisson.Generate(1000000).ToDouble();

            // Let's pretend we don't know from which distribution
            // those sample come from, and create an analysis object
            // to check it for us:
            var analysis = new DistributionAnalysis(samples);

            // Compute the analysis
            analysis.Compute();

            // Get the most likely distribution
            var mostLikely = analysis.GoodnessOfFit[0];

            // The result should be Poisson(x; λ = 0.420961)
            var result = mostLikely.Distribution.ToString();

            Assert.AreEqual("Poisson(x; λ = 0.420961)", result);
        }
        public void GenerateTest3()
        {
            double lambda = 0.75;
            var a = new PoissonDistribution(lambda) as ISampleableDistribution<double>;


            Accord.Math.Random.Generator.Seed = 0;
            double[] expected = a.Generate(samples: 10000);

            Accord.Math.Random.Generator.Seed = 0;
            var b = new PoissonDistribution(lambda);
            Accord.Math.Random.Generator.Seed = 0;
            int[] actual = b.Generate(10000);

            Assert.IsTrue(expected.IsEqual(actual));
        }