You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
541 B

4 years ago
  1. /* Built-in method references for those with the same name as other `lodash` methods. */
  2. var nativeFloor = Math.floor,
  3. nativeRandom = Math.random;
  4. /**
  5. * The base implementation of `_.random` without support for returning
  6. * floating-point numbers.
  7. *
  8. * @private
  9. * @param {number} lower The lower bound.
  10. * @param {number} upper The upper bound.
  11. * @returns {number} Returns the random number.
  12. */
  13. function baseRandom(lower, upper) {
  14. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  15. }
  16. module.exports = baseRandom;