This question already has an answer here:
I have the following code inside a static method in a static class:
Random r = new Random();
int randomNumber = r.Next(1,100);
I have this inside a loop and I keep getting the same randomNumber
!
Any suggestions here?
Note, this is not to be used for cryptographic purposes.
A good seed initialisation can be done like this
The ticks will be unique and the cast into a int with probably a loose of value will be OK.