110,545
社区成员
发帖
与我相关
我的任务
分享
//generate random numbers
Hashtable hashtable = new Hashtable();
Random rm = new Random();
int RmNum = strlength ;
int j = 0;
for (int i = 0; hashtable.Count < RmNum; i++)
{
int nValue = rm.Next(str.Length );
if (!hashtable.ContainsValue(nValue) && nValue != 0)
{
hashtable.Add(nValue, nValue);
//richTextBox1 .Text += nValue.ToString() + "\t";
strRan[j] = nValue.ToString();
j++;
}
}