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++; } }
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"); } }
public AllocTestMultiRankMap(IMultiRankMap <int, float> actual) { this.actual = actual; }
public override void UntimedPrepare() { tree = makeTree(count); }