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
1 changed files with 2 additions and 2 deletions

View File

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