mardi 29 décembre 2015

Generate random int and use it about 5 times before it changes to a new random number

Total newb pls help..there is a similar question but i didn't understand the explanation. I have this code

public int randomindex = new Random().nextInt(whatifphrases.length);

private String[] question = new String[]{
            why[randomindex],
            but[randomindex]
};

private int[] likability = new int[]{
        like[randomindex],
        dislike[randomindex]
};

I want the likability and question arrays use the same random number. For example, i want why[10] but[10] like[10] dislike [10] but what i get is why[10] but[10] like[15] dislike [15]




Aucun commentaire:

Enregistrer un commentaire