This question already has an answer here:
I am using new Random().nextInt(999999)
to generate a 6 digit random number. But sometimes it generates 5 digit numbers. And I explicitly have to check if generated number is not 6 digit.
Why this method does that? And is there any other way to be pretty sure it generate only 6 digit random number.
Aucun commentaire:
Enregistrer un commentaire