Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript random number in range

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