So I'm trying to make a JS project that involves RNG (random number generation).
I'm using a var
object with the random number generator in it. Heres an example of what I'm talking about:
var RNG = Math.floor(Math.random() * (863 - 768 + 1)) + 768;
document.getElementById("output").innerHTML = RNG +" "+ RNG +" "+ RNG;
I'm expecting this to give 3 different random numbers in the element with the ID "output". I instead get 3 of the same random number. What can I do to get 3 different random numbers instead of 3 of the same random numbers?
Aucun commentaire:
Enregistrer un commentaire