Return a random int, used by `utils.uid()` - Node.js Number

Node.js examples for Number:Random Number

Description

Return a random int, used by `utils.uid()`

Demo Code


/**//ww w  .ja v  a  2  s  . co  m
 * Return a random int, used by `utils.uid()`
 *
 * @param {Number} min
 * @param {Number} max
 * @return {Number}
 * @api private
 */
function getRandomInt(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

Related Tutorials