In the LoopLotteryNumbers method, comment out Thread.Sleep(200) and see what effect this has on application.

Computers cannot create truly random numbers, but RNGCryptoServiceProvider comes closest to what this example is looking to achieve.

The final result when running the code can be seen below.

C# random int generator

I hope you found this short blog helpful in creating a C# random number generator. If yes, please leave a comment below.

Leave a comment