Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript random number in range

function getRandomIntInclusive(min, max) {
  min = Math.ceil(min);
  max = Math.floor(max);
  return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive 
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #random #number #range
ADD COMMENT
Topic
Name
2+2 =