IEnumerable Randomize extension methods
A tiny class that is simple to use. Compile and include in your project and two new methods will become available on objects declared as IEnumerable.
There are two methods:
-
Randomize var list = new List(); ... foreach(var element in list.Randomize()) { ...spits out elements randomly }
-
ChooseRandom var list = new List(); ... var randomElement = list.ChooseRandom(); //Chooses an element from the list at random.