mercredi 4 mai 2016

How to make a math.random into a for loop

in short form, i created a math.random that will choose a random number, then another variable later will use that number, then math.random will choose another number. I would think to use a for loop with the math.random making it look something like this:

for (int i = 0; i <100; i++) {
    int mRandom = (int) (Math.random() * 21 + 15);
}

i'm trying to figure out how to make it loop, so i decided to just make it loop 100 times, by which time the number wont be useful anymore. but for some reason the for loop is assuming that the i in "i < 100" is a class, and is creating an error for the first line. Help?




Aucun commentaire:

Enregistrer un commentaire