public Record GetWord(EngPopup.DictionsControl dictions) { IList<Record> allRecords = new List<Record>(); foreach(var item in dictions.GetUsingdictions()) { Record row = new Record(item.ToString()); row.freq = this.NextValue(); if(row.SelectByFreq()) allRecords.Add(row); } if(allRecords.Count==0) return this.ErrorRecord(""); var maxfreq = allRecords.Max(x => x.freq); var allMaxRecords = allRecords.Where(x => x.freq == maxfreq); allRecords = allMaxRecords.ToList(); Random r = new Random(); return allRecords[r.Next(0,allRecords.Count-1)]; }