Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

random numbers function (min, max)

//math.random gives us numbers between 0 and 1
//when we multiply it on max-min we get numbers between 0 and (max-min)
//after that we add min both max and min so we have number between min and max
//function gives us random numbers between 2 numbers we will specify
const randomInt = (min, max) =>
  Math.floor(Math.random() * (max - min) + 1) + min;
randomInt(min, max);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #random #numbers #function
ADD COMMENT
Topic
Name
2+1 =