using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace iWareCommon.Utils
|
{
|
/// <summary>
|
/// LIST帮助类
|
/// </summary>
|
public class ListHelper
|
{
|
/// <summary>
|
/// LIST打乱顺序
|
/// </summary>
|
/// <param name="oldList">要处理的LIST</param>
|
/// <returns>打乱顺序后的LIST</returns>
|
public static List<T> RandomList<T>(List<T> oldList)
|
{
|
Random r = new Random(Guid.NewGuid().GetHashCode());
|
List<T> newList = new List<T>();
|
foreach (var item in oldList)
|
{
|
newList.Insert(r.Next(newList.Count), item);
|
}
|
return newList;
|
}
|
}
|
}
|