//The MIT License (MIT)
//http://arolibraries.codeplex.com/license
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
namespace AroLibraries.ExtensionMethods.Enumerable
{
public static class IEnumerableExt
{
public static IEnumerable<T> Ext_Shuffle<T>(this IEnumerable<T> list)
{
var r = new Random((int)DateTime.Now.Ticks);
var shuffledList = list.Select(x => new { Number = r.Next(), Item = x })
.OrderBy(x => x.Number).Select(x => x.Item);
return shuffledList.ToList();
}
}
}
|