Files
lodash/internal/baseRandom.js
John-David Dalton 8c26e6fd4c Bump to v4.0.0.
2016-01-13 01:10:19 -08:00

22 lines
592 B
JavaScript

define([], function() {
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeFloor = Math.floor,
nativeRandom = Math.random;
/**
* The base implementation of `_.random` without support for returning
* floating-point numbers.
*
* @private
* @param {number} lower The lower bound.
* @param {number} upper The upper bound.
* @returns {number} Returns the random number.
*/
function baseRandom(lower, upper) {
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
}
return baseRandom;
});