Get random integer with upper limit - Node.js Number

Node.js examples for Number:Random Number

Description

Get random integer with upper limit

Demo Code

/**/*from   ww  w .j a v  a  2s .co m*/
 * Get random integer
 */
function get_random_integer(upper_limit) {
  var number = Math.floor((Math.random() * upper_limit) + 1);
  return number;
}

Related Tutorials