// PUBLIC METHODS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // CREATE the public PickElements method here ---------------------------- public void PickElements() { if (ElementList.Count > 0) { //ElementList and NumberList call their clear method: ElementList.Clear(); NumberList.Clear(); //build method is called: this._build(); //6 random numbers are selected from NumberList, they are added to the ElementList and then removed from NumberList: IEnumerable <int> threeRandom = NumberList.OrderBy(x => Random.Next()).Take(this.ElementNumber); foreach (int y in threeRandom) { ElementList.Add(y); } ElementList.Sort(); NumberList.RemoveAll(c => ElementList.ToList().Exists(n => n == c)); } else { //build method is called: this._build(); //6 random numbers are selected from NumberList, they are added to the ElementList and then removed from NumberList: IEnumerable <int> threeRandom = NumberList.OrderBy(x => Random.Next()).Take(ElementNumber); foreach (int y in threeRandom) { ElementList.Add(y); } NumberList.RemoveAll(c => ElementList.ToList().Exists(n => n == c)); } }