Simple question but I can't find the answer, I'm pretty bad with maths. The thing is that i have this formula to generate a random number.
public randomize(min, max) {
console.log("minimo: " + min);
console.log("maximo: " + max);
return this.numRandomed = Math.floor(Math.random()*(max-min+1)+min);
}
But the random number is always lower than the min number, isn't inside the range, I don't know why...
Any clue?? Thank you!!
Aucun commentaire:
Enregistrer un commentaire