vendredi 7 septembre 2018

I want to generate random numbers within given range in java

For that, I got the solution but I can't understand it: I have used below function to generate random numbers within the given range but what is the meaning of below function?

  static int randomRangeInNumber(int min, int max) {
    Random r=new Random();
    return r.nextInt((max-min)+1)+min;
}

What i have returned i didnt get Please help making me understand its meaning any help will be appreciated




Aucun commentaire:

Enregistrer un commentaire