示例#1
0
        public static void Random_sample_throws_if_count_less_than_zero()
        {
            const double min = 10;
            const double max = 1500;

            var normal = Uniform.Between(min, max, Seed);

            Assert.Throws <ArgumentOutOfRangeException>(() => normal.Sample(-1));
        }
示例#2
0
        public static void Random_clamped_uniform_range_zero()
        {
            const int    count = 150_000;
            const double min   = 10;
            const double max   = 10;

            var normal = Uniform.Between(min, max, Seed);

            double[] values = normal.Sample(count).ToArray();

            Assert.All(values, n => Assert.True(n == min));
        }
示例#3
0
        public static void Random_clamped_uniform()
        {
            const int    count = 100_000;
            const double min   = 10;
            const double max   = 1500;

            var normal = Uniform.Between(min, max, Seed);

            double[] values = normal.Sample(count).ToArray();

            Assert.All(values, n => Assert.True(n >= min && n <= max));

            int groupCount = values
                             .GroupBy(n => n)
                             .Count();

            Assert.True(groupCount >= 1000); // 1,479
        }