Monday, 2 November 2015

How to generate a random unique 5 digit number in C#

Here is the way to generate 5 digit random unique number.
Random objRandom = new Random();
int intValue = objRandom.Next(10000, 99999);
The number 10000, 99999 specifies the range

For example - If you want generate 6 digit random number, just increase the range to 100000, 999999.
Hope this helps.
Happy Coding

No comments:

Post a Comment