samedi 26 octobre 2019

Random Number Generation within a range

I am trying to print a random number between 80 and 100. However when I print out this number I am getting numbers over 100?

Random num = new Random();
int percent = 80 + num.nextInt(100);
System.out.println(percent);



Aucun commentaire:

Enregistrer un commentaire