I wrote a function:
function rand(minDit, maxDit){
return Math.floor(Math.random() * (maxDit - minDit + 1)) + minDit;
}
I use it to generate a random integer from minDit to maxDit, I want to know if there is a better solution ?
I wrote a function:
function rand(minDit, maxDit){
return Math.floor(Math.random() * (maxDit - minDit + 1)) + minDit;
}
I use it to generate a random integer from minDit to maxDit, I want to know if there is a better solution ?