mardi 13 février 2018

How to fill array with random numbers between 10 and 95?

I am unsure as how to fill my array of random integers between 10 and 95. I was taught that one way was to to random.nextInt(10)+1 if I wanted it to be between 1 and 10. But I don't know how to do 10 and 95. Thank you.

public static void fillArray(int[] array){
    int length = array.length;
    Random random = new Random(2625);

    for (int i = 0; i < length; i++) {
        array[i] = random.nextInt();
    }

}




Aucun commentaire:

Enregistrer un commentaire