关于c#生成随机数,为什么生成的都一样?
ArrayList list=new ArrayList();int i;
for(i=1;i<=10;i++)
{
Random rani = new Random(unchecked((int)DateTime.Now.Ticks+i));
list.Add(rani.Next(1, 100));
}
//Console.WriteLine(list[0]);
Console.ReadKey();
Random rani = new Random(); ArrayList list = new ArrayList(); int i; for (i = 1; i <= 10; i++) { list.Add(rani.Next(1, 100)); }