Make _.random return 0 or 1 when no arguments are passed.

Former-commit-id: 7d20f5240d534f0091757f613c664b08e0d45759
This commit is contained in:
John-David Dalton
2012-09-18 20:29:36 -07:00
parent f85287a444
commit 6499643769
2 changed files with 5 additions and 9 deletions

View File

@@ -1163,9 +1163,9 @@
QUnit.module('lodash.random');
(function() {
test('should work like `Math.random` if no arguments are passed', function() {
test('should return `0` or `1` when no arguments are passed', function() {
var actual = _.random();
ok(actual >= 0 && actual < 1);
ok(actual === 0 || actual === 1);
});
test('supports not passing a `max` argument', function() {