I have just passed this article online:
C# Corner and C# Corner and his article (a software developer with over 13 years of experience) recommended using System.Random as follows:
private int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
Isn’t that would give him the same number every time ??
Edit:
So my question will become: How does Random choose its seed? a constant or current time value?
Thanks
It will give the same result when the method will be called often between short time intervals. This is because the
Randoms seed is initialized with the current time value.This is also the reason why many people have problem of kind that random is not random at all.
BTW it is not Math.Random but System.Random
Following your edit, here is some information on how random is initialized. The information comes from the link above.