-
c#生成不重复随机数
-
-
- static List<int> GetRandomArray(int maxNumber,int count)
- {
- List<int> list = new List<int>();
- int[] array=new int[maxNumber];
- for (int i = 0; i < maxNumber; i++)
- array[i] = i + 1;
- Random rnd = new Random();
- for (int j = 0; j < count; j++)
- {
- int index = rnd.Next(j,maxNumber);
- int temp = array[index];
- list.Add(temp);
- array[index] = array[j];
- array[j] = temp;
- }
- return list;
- }
-
相关阅读:
uva-11361
HDU
LCS
CodeForces
linux 有趣的命令组合
opencv识别封闭区域 并标记该区域
宜出行人口热力图
美团酒店
赶集租房
发送企业微信应用通知
-
原文地址:https://www.cnblogs.com/zzxap/p/2175911.html
Copyright © 2020-2023
润新知