maztt maztt - 14 days ago 9
C# Question

asp.net mvc c# random generating same number

how can i generate different number,it is generating the same number

Random rand = new Random(100000);
rand.Next();

Answer

Just remove the seed number in the constructor. This seed is essentially a number from which the random number list is generated. If you specify a constant number, your random number list will always be the same.

Random rand = new Random();
rand.Next();