我的程序要用到很多随机数,但由于程序当中随机种子是时间,由于运行时间快。产生的随机数都一样。也就失去随机性了。怎么更好地解决。谢谢
Random a=new Random(unchecked((int)DateTime.Now.Millisecond));
int b=a.Next(1,100);
Random a=new Random(unchecked((int)DateTime.Now.Millisecond));
int b=a.Next(1,100);
timer1.Interval = 50;
timer2.Interval = 1000;
private void timer1_Tick(object sender, EventArgs e)
{
Random rd = new Random();
textBox1.Text = rd.Next(1, 9999).ToString();
} private void timer2_Tick(object sender, EventArgs e)
{
timer1.Enabled = false;
}