I want to generate an unique 4 digit random number. This is the below code what I have tried
Code for generating random no
//Generate RandomNo
public int GenerateRandomNo()
{
int _min = 0000;
int _max = 9999;
Random _rdm = new Random();
return _rdm.Next(_min, _max);
}
The problem is I have received a random no with value 241 which is not a 4 digit number.Is there any problem with the code.
Any help will be highly appreciated.
Aucun commentaire:
Enregistrer un commentaire