一个函数搞定
public void preRun()
{
Random ran = new Random();
int i;
for(i =1;i<=10;i++)
{
int RandKey = ran.Next(100, 999);//100,999分别代表随机数起始和结束
this.listBox1.Items.Add(RandKey);
}
}
Random rdn = new Random();
for (int i = 0; i < 10; i++)
{
int b = rdn.Next();
listBox1.Items.Add(b);
}