- using System.Collections;
- using System;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- ArrayList al = new ArrayList();
- //生成数据
- int dataLength = 10;
- for (int i = 0; i < dataLength; i++)
- {
- al.Add(i);
- }
- Random rd = new Random();
- for (int j = 0; j < dataLength; j++)
- {
- int randomIndex = rd.Next(0, al.Count);
- Console.Write(al[randomIndex].ToString() + " ");
- al.RemoveAt(randomIndex);
- }
- Console.WriteLine();
- }
- }
- }
- 每次运行产生不同的序列
每次运行产生不同随机数
最新推荐文章于 2022-11-18 08:55:45 发布