SIGN IN SIGN UP

A modern JavaScript utility library delivering modularity, performance, & extras.

0 0 47 JavaScript
2015-01-08 00:37:01 -08:00
define([], function() {
2015-12-16 17:53:20 -08:00
/* Built-in method references for those with the same name as other `lodash` methods. */
2015-12-16 17:52:15 -08:00
var nativeFloor = Math.floor,
nativeRandom = Math.random;
2015-01-08 00:37:01 -08:00
/**
2015-12-16 17:53:20 -08:00
* The base implementation of `_.random` without support for returning
* floating-point numbers.
2015-01-08 00:37:01 -08:00
*
* @private
2015-12-16 17:53:20 -08:00
* @param {number} lower The lower bound.
* @param {number} upper The upper bound.
2015-01-08 00:37:01 -08:00
* @returns {number} Returns the random number.
*/
2015-12-16 17:53:20 -08:00
function baseRandom(lower, upper) {
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
2015-01-08 00:37:01 -08:00
}
return baseRandom;
});