From a61f41a79afadeb401145e7b815eab3204e3fcb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipi=C5=84ski?= Date: Thu, 16 Feb 2017 18:49:36 +0100 Subject: [PATCH] Complete baseRandom removal (cb7612a). --- random.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/random.js b/random.js index d53078d3f..d9ea6037f 100644 --- a/random.js +++ b/random.js @@ -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