Esempio n. 1
0
        public void NextInt32_Distribution()
        {
            var M = 3;

            var values = Enumerable.Repeat(false, 10000)
                         .Select(_ => NormalDistribution.NextInt32(M))
                         .ToArray();

            BinomialDistributionTest.WriteSummary(values, 2 * M);
        }
Esempio n. 2
0
        public void NextInt32ByMinMax_Distribution()
        {
            var m = 11;
            var M = 16;

            var values = Enumerable.Repeat(false, 10000)
                         .Select(_ => NormalDistribution.NextInt32ByMinMax(m, M))
                         .ToArray();

            BinomialDistributionTest.WriteSummary(values, M - m);
        }
Esempio n. 3
0
        public void NextInt32_Uniform()
        {
            var n           = 6;
            var confidence  = 3.0;
            var mean        = n / 2.0;
            var maxAbsValue = mean + 0.5;
            var sigma       = maxAbsValue / confidence;
            var sidePoints  = 1024;

            var values = BinomialDistributionTest.GetValuesFromUniform(sidePoints)
                         .Select(x => x * sigma)
                         .Where(x => Abs(x) < maxAbsValue)
                         .Select(x => (int)Round(x + mean, MidpointRounding.AwayFromZero))
                         .ToArray();

            BinomialDistributionTest.WriteSummary(values, n);
        }