vendredi 10 juillet 2015

Android- keep regenerating different random numbers

I am making an app for android, and I need a number, that will keep changing randomly every time I call it.

But, if I do this:

Random r = new Random(); // makes random r
public int rndNum = r.nextInt(1000) + 7; 

and use rndNum a few times, it remains the same randomly generated number every time.

is there a way to keep regenerating the random number?




Aucun commentaire:

Enregistrer un commentaire