mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
When floating in _.random avoid getting 0 too many times when using arguments like min of -3 and max of 3.
This commit is contained in:
@@ -6016,7 +6016,7 @@
|
|||||||
}
|
}
|
||||||
var rand = nativeRandom();
|
var rand = nativeRandom();
|
||||||
return (floating || min % 1 || max % 1)
|
return (floating || min % 1 || max % 1)
|
||||||
? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max)
|
? nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max)
|
||||||
: min + floor(rand * (max - min + 1));
|
: min + floor(rand * (max - min + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user