I have a method that returns a random value.
public int newRandom() {
Random random = new Random();
int o = random.nextInt(9 - 0 + 1) + 0;
return o;
}
After I generate that value I'm currently setting a variable inside another method to the result of this function, what I want to do is have another class know the same result that variable has, what I mean is both having the same random number, I for some reason can't figure this out on my own. What would be the best way of achieving this?
Aucun commentaire:
Enregistrer un commentaire