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:
John-David Dalton
2013-09-25 23:24:58 -07:00
parent 0ea54f0458
commit 9b80e3a33b

View File

@@ -6016,7 +6016,7 @@
}
var rand = nativeRandom();
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));
}