using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int[] t = new int[25]; int[] tt = new int[25]; for (int i = 0; i < 25; i++) t[i] = i; Random r = new Random(); int N=25; for (int j = 0; j < 25; j++) //最后数据放在 tt 中 { int temp = r.Next() % N; // Console.Write(temp + " "); tt[j] = t[temp]; if(temp==N-1) { N--; continue; } else for (int k = temp + 1; k < N; k++) { t[k-1] = t[k]; } N--; } } } }
随机数组 c#
最新推荐文章于 2022-03-27 19:31:42 发布