public static void Fill(TreeEntry entry, double chance) { double f; while ((f = r.NextDouble()) < chance) { var e = new TextTreeEntry(f.ToString()); entry.Add(e); Fill(e, chance * chance); } }
void Discover(TreeEntry entry, DirectoryInfo di, int level, int maxlevel) { if (level > maxlevel) { return; } var child = new TextTreeEntry(di.Name); entry.Add(child); foreach (var dir in di.GetDirectories()) { Discover(child, dir, level + 1, maxlevel); } }