Skip to content

Commit

Permalink
fix(random): Fix random with a number issue
Browse files Browse the repository at this point in the history
It was returning an array of empty values because I have no idea how to program :-(
  • Loading branch information
Kent C. Dodds committed Aug 22, 2015
1 parent 222e48c commit 9f508d3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 9f508d3

Please sign in to comment.