Add floating argument to _.random. [closes #354]

This commit is contained in:
John-David Dalton
2013-09-20 00:21:42 -07:00
parent fca3a14410
commit ca81f1b2e8
9 changed files with 149 additions and 63 deletions

View File

@@ -3065,6 +3065,17 @@
ok(actual % 1);
ok(actual >= min && actual <= max);
});
test('supports passing a `floating` argument', function() {
var actual = _.random(true);
ok(actual % 1 && actual >= 0 && actual <= 1);
actual = _.random(2, true);
ok(actual % 1 && actual >= 0 && actual <= 2);
actual = _.random(2, 4, true);
ok(actual % 1 && actual >= 2 && actual <= 4);
});
}());
/*--------------------------------------------------------------------------*/