Accord.Tests.Statistics.BernoulliDistributionTest.GenerationTest C# (CSharp) Method

GenerationTest() private method

private GenerationTest ( ) : void
return void
        public void GenerationTest()
        {
            double prob = 0.5;
            int trials = 100000;

            BernoulliDistribution target = new BernoulliDistribution(prob);
            target.Fit(target.Generate(trials).Select(x => (double)x).ToArray());

            Assert.AreEqual(target.Mean, prob, 1e-2);
        }
    }