本文整理汇总了C#中DiscreteUniform类的典型用法代码示例。如果您正苦于以下问题:C# DiscreteUniform类的具体用法?C# DiscreteUniform怎么用?C# DiscreteUniform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DiscreteUniform类属于命名空间,在下文中一共展示了DiscreteUniform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUpperBoundFails
public void SetUpperBoundFails(int p)
{
var b = new DiscreteUniform(0, 10);
Assert.That(() => b.UpperBound = p, Throws.ArgumentException);
}
示例2: SetUpperBoundFails
public void SetUpperBoundFails(int p)
{
var b = new DiscreteUniform(0, 10);
Assert.Throws<ArgumentOutOfRangeException>(() => b.UpperBound = p);
}
示例3: CanCreateDiscreteUniform
public void CanCreateDiscreteUniform(int l, int u)
{
var du = new DiscreteUniform(l, u);
Assert.AreEqual(l, du.LowerBound);
Assert.AreEqual(u, du.UpperBound);
}
示例4: SetUpperBoundFails
public void SetUpperBoundFails(int p)
{
var b = new DiscreteUniform(0, 10);
b.UpperBound = p;
}
示例5: ValidateProbabilityLn
public void ValidateProbabilityLn(int l, int u, int x, double dln)
{
var b = new DiscreteUniform(l, u);
Assert.AreEqual(dln, b.ProbabilityLn(x));
}
示例6: CanSampleSequence
public void CanSampleSequence()
{
var n = new DiscreteUniform(0, 10);
var ied = n.Samples();
ied.Take(5).ToArray();
}
示例7: ValidateSkewness
public void ValidateSkewness([Values(-10, 0, 10, 20)] int l, [Values(10, 4, 20, 20)] int u)
{
var du = new DiscreteUniform(l, u);
Assert.AreEqual(0.0, du.Skewness);
}
示例8: ValidateMean
public void ValidateMean(int l, int u, int m)
{
var du = new DiscreteUniform(l, u);
Assert.AreEqual(m, du.Mean);
}
示例9: SetLowerBoundFails
public void SetLowerBoundFails([Values(11, 20)] int p)
{
var b = new DiscreteUniform(0, 10);
Assert.Throws<ArgumentOutOfRangeException>(() => b.LowerBound = p);
}
示例10: ValidateEntropy
public void ValidateEntropy([Values(-10, 0, 10, 20)] int l, [Values(10, 4, 20, 20)] int u, [Values(3.0445224377234229965005979803657054342845752874046093, 1.6094379124341003746007593332261876395256013542685181, 2.3978952727983705440619435779651292998217068539374197, 0.0)] double e)
{
var du = new DiscreteUniform(l, u);
AssertHelpers.AlmostEqual(e, du.Entropy, 14);
}
示例11: CanSetUpperBound
public void CanSetUpperBound(int p)
{
var b = new DiscreteUniform(0, 10);
b.UpperBound = p;
}
示例12: ValidateMode
public void ValidateMode(int l, int u, int m)
{
var du = new DiscreteUniform(l, u);
Assert.AreEqual<double>(m, du.Mode);
}
示例13: ValidateMinimum
public void ValidateMinimum()
{
var b = new DiscreteUniform(-10, 10);
Assert.AreEqual<double>(-10, b.Minimum);
}
示例14: ValidateEntropy
public void ValidateEntropy(int l, int u, double e)
{
var du = new DiscreteUniform(l, u);
AssertHelpers.AlmostEqualRelative(e, du.Entropy, 14);
}
示例15: ValidateMean
public void ValidateMean([Values(-10, 0, 10, 20)] int l, [Values(10, 4, 20, 20)] int u, [Values(0, 2, 15, 20)] int m)
{
var du = new DiscreteUniform(l, u);
Assert.AreEqual(m, du.Mean);
}