Took 3 minutes and 21 seconds to code JavaScript method to return random number in a range exclusive of the max limit. Here is the code snippet.
Code:
function randomMaxExclusive(min, max) {
x = Math.floor((Math.random() * max - min) + min);
return x;
}
x = randomMaxExclusive(0, 10)
document.write(x);
Result:
4
No comments:
Post a Comment