Fix typo in random.subset: limit should only be randomized if it is not specified

This commit is contained in:
Jesse Schwartzentruber 2017-04-20 15:14:33 -04:00
parent b7d4cbd043
commit 8e084eb878

View file

@ -133,8 +133,8 @@ var random = {
Utils.traceback(); Utils.traceback();
throw new TypeError("random.some() received a non-array type: '" + list + "'"); throw new TypeError("random.some() received a non-array type: '" + list + "'");
} }
if (typeof limit == 'number') { if (typeof limit !== 'number') {
limit = this.range(0, list.length); limit = this.number(list.length + 1);
} }
let result = []; let result = [];
for (let i = 0; i < limit; i++) { for (let i = 0; i < limit; i++) {