Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript math random floor

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 #math #random #floor
ADD COMMENT
Topic
Name
8+5 =