Randomize

public static class Extensions
{
	public static IEnumerable<T> Randomize<T>(this IEnumerable<T> source)
	{
		return source.OrderBy (s => Guid.NewGuid() );
	}
}
Example:
void Main()
{
	var ints = new[] {1,2,3,4,5,6,7,8,2,3,4,12,243,4,5,34,24,3,45,45,6,45,6,34,56,534};
	ints.Randomize().Dump();
}

Description

Randomizes am IEnumerable<T>

Details

Double click on the code to select all.

 

;