コード例 #1
0
        private static void UnloadTree(IMultiRankMap <int, int> tree, int?count, ref ParkAndMiller random)
        {
            int i = 0;

            while ((count.HasValue && (i < count.Value)) || (!count.HasValue && (tree.Count != 0)))
            {
                int rank = random.Next() % unchecked ((int)tree.RankCount);
                int key  = tree.GetKeyByRank(rank);
                tree.Remove(key);
                i++;
            }
        }
コード例 #2
0
 private static void LoadTree(IMultiRankMap <int, int> tree, int count, ref ParkAndMiller random)
 {
     for (int i = 0; i < count; i++)
     {
         int key       = random.Next();
         int rankCount = random.Next() % 100 + 1;
         tree.TryAdd(key, key, rankCount);
     }
     if (tree.Count < .999 * count)
     {
         throw new InvalidOperationException("too many collisions - choose a better seed");
     }
 }
コード例 #3
0
ファイル: UnitTestAllocation.cs プロジェクト: fsgeek/TreeLib
 public AllocTestMultiRankMap(IMultiRankMap <int, float> actual)
 {
     this.actual = actual;
 }
コード例 #4
0
 public override void UntimedPrepare()
 {
     tree = makeTree(count);
 }