From 9f508d3cec56860b29c872c94c535d3e42a8a790 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Sat, 22 Aug 2015 15:11:44 -0600 Subject: [PATCH] fix(random): Fix random with a number issue It was returning an array of empty values because I have no idea how to program :-( --- src/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 29dada7..c72b8ec 100644 --- a/src/index.js +++ b/src/index.js @@ -12,8 +12,10 @@ function random(number) { if (number === undefined) { return getRandomItem(); } else { - return new Array(number).map(function() { - return getRandomItem(); - }); + var randomItems = []; + for (var i = 0; i < number; i++) { + randomItems.push(getRandomItem()); + } + return randomItems; } }