按照以前学过的写一个方法生成随机数:
private string randomNum()
{
ArrayList list = new ArrayList();
string str = "0,1,2,3,4,5,6,7,8,9";
list.AddRange(str.Split(','));
//随机码。
string randomContent = "";
Random rd = new Random();
//设置随机码的个数。
int nuM = 10;
for (int i = 0; i < nuM; i++)
{
randomContent += list[rd.Next(0, 35)];
}
return randomContent;
}
|