Complete baseRandom removal (cb7612a).

This commit is contained in:
Michał Lipiński
2017-02-16 18:49:36 +01:00
parent 53dba0a211
commit a61f41a79a

View File

@@ -1,4 +1,3 @@
import baseRandom from './.internal/baseRandom.js'
import isIterateeCall from './.internal/isIterateeCall.js'
import toFinite from './toFinite.js'
@@ -8,6 +7,7 @@ const freeParseFloat = parseFloat
/* Built-in method references for those with the same name as other `lodash` methods. */
const nativeMin = Math.min
const nativeRandom = Math.random
const nativeFloor = Math.floor
/**
* Produces a random number between the inclusive `lower` and `upper` bounds.
@@ -75,7 +75,7 @@ function random(lower, upper, floating) {
const rand = nativeRandom()
return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper)
}
return baseRandom(lower, upper)
return lower + nativeFloor(nativeRandom() * (upper - lower + 1))
}
export default random