List<KeyValuePair<string, bool>> temp = AnArray.Where(p => !p.Value).ToList();
var randomItem = temp.ElementAt(rand.Next(0, temp.Count - 1)).Key;
The code above is the way im currently doing it. but the .ToList() and kind of the .Where() aswell is using quite a bit of CPU in my workflow.
Is there any unique way to randomly select 1 element from an enumerable using the least CPU as possible perhaps without doing a ToArray/ToList and possibly without a Random() either?