public void RandSort(int[] _num) { Random rd = new Random(); int temp = 0, tempNum = 0; for (int i = 0; i < _num.Length-1; i++) { temp = rd.Next(i, _num.Length); tempNum=_num[i]; _num[i] = _num[temp]; _num[temp] = tempNum; Thread.Sleep(20);//注意:引入命名空间:System.Threading; } string str = null; foreach (int item in _num) { str += item.ToString() + ","; } MessageBox.Show(str); }