Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate 8 digits UNIQUE & RANDOM number in C# [closed]

Tags:

c#

numbers

unique

Does any body know, how to create unique & random 8 digits number? There are methods to create random numbers, but my requirement is to create an unique also it should be a random number with 8 digits. Any idea?

like image 382
Aruna Avatar asked Dec 20 '22 10:12

Aruna


1 Answers

Random rnd = new Random();
int myRandomNo= rnd.Next(10000000, 99999999); // creates a 8 digit random no.
like image 171
Som Poddar Avatar answered Dec 22 '22 22:12

Som Poddar