Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

generate random whole numbers within a range

var myMin = 1;
var myMax = 10;
function randomRange(myMin, myMax) {
  return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin;
}

console.log(randomRange(myMin, myMax));
Source by forum.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #generate #random #numbers #range
ADD COMMENT
Topic
Name
4+9 =