Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript get random number

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