public static ClassicLinkedList <int> RandomFoundationLinkedList(int count, bool sorted) { Random rnd = new Random(System.Environment.TickCount); IComparer <int> comparer = null; if (sorted) { comparer = Comparer <int> .Default; } ClassicLinkedList <int> result = new ClassicLinkedList <int> (comparer); int i = 0; while (i++ < count) { //int val = rnd.Next (1000); int val = rnd.Next(count); //Console.WriteLine (val); result.AddSorted(val, true); //result.AddLast (val); //result.CheckForSortingErrors (); /** * if (result.CheckForSortingErrors () > 0) * break; **/ } //result.Sort (); return(result); }
public AnimationService(double frameRate) { FrameRate = Math.Max(10, Math.Min(360, frameRate)); // SortedLinkedList has a 'robust' iterator // no such 'Collection was modified ..' exceptions anymore :) AnimationTargets = new ClassicLinkedList <AnimationTarget> (); Enabled = true; }
public static ClassicLinkedList <int> SequentialLinkedList(int count) { ClassicLinkedList <int> result = new ClassicLinkedList <int> (); int i = 0; while (i++ < count) { result.AddSorted(i, true); } return(result); }