This question already has an answer here:
I'm attempting to use math.random(); to randomize numbers between 1 and 50, but it's not really working.
What I currently have is this:
int rand = (int) (50 + Math.random () * 250);
I know it has something do with the multiplication and addition values, but I can't quite figure it out. All I'd simply like to do is randomize numbers between 1 and 50, and it has to be using Math.random(). I would like to only use addition and multiplication values within the math.random() statement to randomize the integers. Any help would be appreciated.
Thanks, Hayden
Aucun commentaire:
Enregistrer un commentaire