Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

random integer from 1 to 10 js

function randomIntFromInterval(min, max) { // min and max included 
  return Math.floor(Math.random() * (max - min + 1) + min)
}

const rndInt = randomIntFromInterval(1, 6)
console.log(rndInt)
 Run code snippet
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #random #integer #js
ADD COMMENT
Topic
Name
5+5 =