vendredi 16 janvier 2015

android get random number between 5 and 10 without duplication

I have a method that I used it to take random number between 5 and 10 but the problem there is a duplication, I want to change the code in a way that I can get random number between 5 and 10 without duplication.


here is my code:



int min = 5;
int max = 10;

Random r = new Random();
int random_number = r.nextInt(max - min + 1) + min;




Aucun commentaire:

Enregistrer un commentaire