本文整理汇总了C#中IGenerator.Next方法的典型用法代码示例。如果您正苦于以下问题:C# IGenerator.Next方法的具体用法?C# IGenerator.Next怎么用?C# IGenerator.Next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGenerator
的用法示例。
在下文中一共展示了IGenerator.Next方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Find
/// <summary>
/// Choosing which child will generate next element of sequence.
/// </summary>
/// <param name="result">
/// Intermediate result.
/// </param>
/// <param name="generator">
/// Random numbers generator.
/// </param>
/// <param name="table">
/// Phantom sequence parameters table.
/// </param>
protected void Find(BaseChain result, IGenerator generator, PhantomTable table)
{
// if not leaf node
if (Children.Count != 0)
{
double val = generator.Next();
ulong curVal = 0;
foreach (TreeNode child in Children)
{
curVal += child.Volume;
if (val <= ((double)curVal / Volume))
{
child.FillChain(result, generator, table);
return;
}
}
}
else
{
// if there is no children nodes then generation is done and decrement procedure is started
Decrement();
}
}