本文整理汇总了C#中CharSetSolver.ChooseUniformly方法的典型用法代码示例。如果您正苦于以下问题:C# CharSetSolver.ChooseUniformly方法的具体用法?C# CharSetSolver.ChooseUniformly怎么用?C# CharSetSolver.ChooseUniformly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CharSetSolver
的用法示例。
在下文中一共展示了CharSetSolver.ChooseUniformly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChooseUnifromlyTest
public void ChooseUnifromlyTest()
{
CharSetSolver solver = new CharSetSolver(BitWidth.BV16);
BDD set1 = solver.MkRangeConstraint('\0', '\x01', true);
BDD set2 = solver.MkRangeConstraint( '\u0FFF', '\u0FFF');
string set2str = solver.PrettyPrint(set2);
BDD set3 = solver.MkRangeConstraint( '\u00FF', '\u00FF');
BDD set4 = solver.MkRangeConstraint( '\u000F', '\u000F');
BDD set = solver.MkOr(new BDD[]{set2, set3, set4, set1});
string setstr = solver.PrettyPrint(set);
set.ToDot(@"foo.dot");
var map = new Dictionary<char, int>();
map['\0'] = 0;
map['\x01'] = 0;
map['\u0FFF'] = 0;
map['\u00FF'] = 0;
map['\u000F'] = 0;
for (int i = 0; i < 50000; i++)
{
var c = solver.ChooseUniformly(set);
map[c] += 1;
}
foreach (var kv in map)
Assert.IsTrue(kv.Value > 9700);
}