对数组序列进行洗牌
2010-12-02 15:28 hailibu 阅读(185) 评论(0) 编辑 收藏 举报
public static void Shuffle<T>(T[] array) { Random random = new Random(); for (int i = 1; i < array.Length; i++) { int j = random.Next(0, i); T temp = array[i]; array[i] = array[j]; array[j] = temp; } }