KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Consider this method: private static int GenerateRandomNumber(int seed, int max) { return new Random(seed).Next(max); } On my machine, executing this loop yields the same number through 1500 iterations: for (int i = 0; i < 1501; i++) { int random = GenerateRandomNumber(100000000, 999999999); Console.WriteLine(random.ToString()); Console.ReadKey(); } I get 145156561, for every single iteration. I don't have a pressing issue, I was just curious about this behavior because .Next(max) says "Returns a Non Negative random number less than the specified maximum. Perhaps I am not understanding something basic.
Tags (comma-separated)
Save Edits
Cancel