??C#?????????????
???????????? ???????[ 2012/7/16 10:34:48 ] ????????
????????1?????????????????????????????????????????????λ??????????λ???????????????????????????????????????????λ?????????? ?????????????????磺?????100????????????????????????????λ??????????1-100?????????1-99??...????????λ??????ú???? ???檔
int[] index = new int[15];
????for (int i = 0; i < 15; i++)
????????index = i;
????Random r = new Random();
????//??????????????????????10????
????int[] result = new int[10];
????int site = 15;//????????
????int id;
????for (int j = 0; j < 10; j++)
????{
????????id = r.Next(1?? site - 1);
????????//?????λ???????????????浽???????
????????result[j] = index[id];
????????//???????????????λ??
????????index[id] = index[site - 1];
????????//λ???????????
????????site--;
????}
????????2??????Hashtable??[NextPage]
Hashtable hashtable = new Hashtable();
????Random rm = new Random();
????int RmNum = 10;
????for (int i = 0; hashtable.Count < RmNum; i++)
????{
???? int nValue = rm.Next(100);
???? if (!hashtable.ContainsValue(nValue) && nValue != 0)
???? {
???? hashtable.Add(nValue?? nValue);
???? Console.WriteLine(nValue.ToString());
???? }
????}
????????3????飬???????????????????????????????????????????????????????????????????????
Random ra=new Random(unchecked((int)DateTime.Now.Ticks));
????int[] arrNum=new int[10];
????int tmp=0;
????int minValue=1;
????int maxValue=10;
????for (int i=0;i<10;i++)
????{
????????tmp=ra.Next(minValue??maxValue); //??????
????????arrNum=getNum(arrNum??tmp??minValue??maxValue??ra); //??????????????
????}
????.........
????.........
????public int getNum(int[] arrNum??int tmp??int minValue??int maxValue??Random ra)
????{
????????int n=0;
????????while (n<=arrNum.Length-1)
????????{
????????????if (arrNum[n]==tmp) //????????ж?????????
????????????{
????????????????tmp=ra.Next(minValue??maxValue); //????????????
????????????????getNum(arrNum??tmp??minValue??maxValue??ra);//???:??????????????????????????????????????????
????????????}
????????n++;
????????}
????????return tmp;
????}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11