本文整理汇总了C#中System.Random.ShouldNotBeNull方法的典型用法代码示例。如果您正苦于以下问题:C# Random.ShouldNotBeNull方法的具体用法?C# Random.ShouldNotBeNull怎么用?C# Random.ShouldNotBeNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Random
的用法示例。
在下文中一共展示了Random.ShouldNotBeNull方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Samples
/// <summary>
/// 연속 균일 분포의 샘플을 생성합니다.
/// </summary>
public static IEnumerable<double> Samples(Random rnd, double lower, double upper) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(lower, upper);
while(true)
yield return DoSample(rnd, lower, upper);
}
示例2: Samples
public static IEnumerable<double> Samples(Random rnd, double alpha, double beta) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(alpha, beta, 1, 0);
return DoSamples(rnd, alpha, beta);
}
示例3: Sample
public static double Sample(Random rnd, double location, double scale) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(location, scale);
return DoSample(rnd, location, scale);
}
示例4: Sample
/// <summary>
/// 연속 균일 분포의 샘플을 생성합니다.
/// </summary>
public static double Sample(Random rnd, double lower, double upper) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(lower, upper);
return DoSample(rnd, lower, upper);
}
示例5: Sample
public static double Sample(Random rnd, double shape, double invScale) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(shape, invScale);
return DoSample(rnd, shape, invScale);
}
示例6: Samples
public static IEnumerable<double> Samples(Random rnd, double shape, double invScale) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(shape, invScale);
while(true)
yield return DoSample(rnd, shape, invScale);
}
示例7: Samples
public static IEnumerable<double> Samples(Random rnd, double scale, double shape) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(scale, shape);
return DoSamples(rnd, scale, shape);
}
示例8: Samples
public static IEnumerable<int> Samples(Random rnd, double p, int n) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(p, n);
return DoSamples(rnd, p, n);
}
示例9: Sample
/// <summary>
/// 지수 분포의 샘플을 제공합니다.
/// </summary>
/// <param name="rnd"></param>
/// <param name="lambda"></param>
/// <returns></returns>
public static double Sample(Random rnd, double lambda) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(lambda);
return DoSample(rnd, lambda);
}
示例10: Samples
public IEnumerable<double> Samples(Random rnd, double location, double scale, double dof) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(location, scale, dof);
return DoSamples(RandomSource, dof).Select(x => location + (scale * x));
}
示例11: Sample
public static double Sample(Random rnd, double scale) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(scale);
return DoSamples(rnd, scale).First();
}
示例12: Samples
public IEnumerable<double> Samples(Random rnd, double d1, double d2) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(d1, d2);
while(true)
yield return DoSample(rnd, d1, d2);
}
示例13: Sample
public double Sample(Random rnd, double d1, double d2) {
rnd.ShouldNotBeNull("rnd");
AssertParameters(d1, d2);
return DoSample(rnd, d1, d2);
}