随机

public static class ListUtils
{
    public static void Shuffle<T>(this IList<T> list)
    {
        int count = list.Count;
        while (count > 1)
        {
            count--;
            int num2 = UnityEngine.Random.Range(0, count + 1);
            T local = list[num2];
            list[num2] = list[count];
            list[count] = local;
        }
    }
}

 

posted @ 2014-10-22 13:38  ing...  阅读(139)  评论(0编辑  收藏  举报