mirror of https://github.com/lukechilds/node.git
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.
19 lines
569 B
19 lines
569 B
10 years ago
|
/* Native method references for those with the same name as other `lodash` methods. */
|
||
9 years ago
|
var nativeFloor = Math.floor,
|
||
|
nativeRandom = Math.random;
|
||
10 years ago
|
|
||
|
/**
|
||
|
* The base implementation of `_.random` without support for argument juggling
|
||
|
* and returning floating-point numbers.
|
||
|
*
|
||
|
* @private
|
||
|
* @param {number} min The minimum possible value.
|
||
|
* @param {number} max The maximum possible value.
|
||
|
* @returns {number} Returns the random number.
|
||
|
*/
|
||
|
function baseRandom(min, max) {
|
||
9 years ago
|
return min + nativeFloor(nativeRandom() * (max - min + 1));
|
||
10 years ago
|
}
|
||
|
|
||
|
module.exports = baseRandom;
|