I am trying to make a simple inclusive random function, but for some reason it gives me NaN. I copied this function from Mozilla reference. Thanks.
var size = {min:1, max: 1700};
function getRndInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function generate() {
document.getElementById("Text1").innerHTML = getRndInt(size.min - size.max);
}
Aucun commentaire:
Enregistrer un commentaire