Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
541 bytes
|
Rev | Line | |
---|
[6a3a178] | 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 | /**
|
---|
| 6 | * The base implementation of `_.random` without support for returning
|
---|
| 7 | * floating-point numbers.
|
---|
| 8 | *
|
---|
| 9 | * @private
|
---|
| 10 | * @param {number} lower The lower bound.
|
---|
| 11 | * @param {number} upper The upper bound.
|
---|
| 12 | * @returns {number} Returns the random number.
|
---|
| 13 | */
|
---|
| 14 | function baseRandom(lower, upper) {
|
---|
| 15 | return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | module.exports = baseRandom;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.