I want to create a string of random numbers, where starting digit should be in the range from 1-9, which selects only single number, after that 2 random digits should be there from range 10-99. Means from range 1-10 let's say 1 is selected, and for 2nd and 3rd digit range should be between 10-99. Like 111, 245...
second digit should not be a single digit.
Tried Code:
int random1 = new Random().nextInt((9 - 1) + 1) + 1;
int random2 = new Random().nextInt((99 - 10) + 1) + 10;
textSelectedFileName.setText(String.valueOf(random1+random2));
Aucun commentaire:
Enregistrer un commentaire