From 8e084eb8784371b30186300726249eec46ac4794 Mon Sep 17 00:00:00 2001 From: Jesse Schwartzentruber Date: Thu, 20 Apr 2017 15:14:33 -0400 Subject: [PATCH] Fix typo in random.subset: limit should only be randomized if it is not specified --- random/random.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/random/random.js b/random/random.js index 8ef510e..e008648 100644 --- a/random/random.js +++ b/random/random.js @@ -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++) {