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)); }
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)); }
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 }