Ensure _.random() returns 1 or 0.

This commit is contained in:
John-David Dalton
2013-12-26 10:09:09 -06:00
parent 0438fa6816
commit e4df75519c
6 changed files with 16 additions and 11 deletions

View File

@@ -6528,17 +6528,18 @@
noMax = max == null;
if (floating == null) {
if (typeof min == 'boolean' && noMax) {
if (noMax && typeof min == 'boolean') {
floating = min;
min = 1;
}
else if (!noMax && typeof max == 'boolean') {
else if (typeof max == 'boolean') {
floating = max;
noMax = true;
}
}
if (noMin && noMax) {
max = 1;
noMax = false;
}
min = +min || 0;
if (noMax) {