Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

random int javascript

/** Generates integers between low (inclusive) and high (exclusive) */
function generateRandomInteger(low, high) {
  const lowCeil = Math.ceil(low);
  const highFloor = Math.floor(high);
  const randomFloat = lowCeil + Math.random() * (highFloor - lowCeil);

  return Math.floor(randomFloat);
}
Source by devimalplanet.com #
 
PREVIOUS NEXT
Tagged: #random #int #javascript
ADD COMMENT
Topic
Name
6+1 =