var uniqueRandomArray = require('unique-random-array');
var starWarsNames = require('./starwars-names.json');

var getRandomItem = uniqueRandomArray(starWarsNames);

module.exports = {
  all: starWarsNames,
  random: random
};

function random(number) {
  if (number === undefined) {
    return getRandomItem();
  } else {
    return new Array(number).map(function() {
      return getRandomItem();
    });
  }
}

var uniqueRandomArray = require('unique-random-array');
var starWarsNames = require('./starwars-names.json');

var getRandomItem = uniqueRandomArray(starWarsNames);

module.exports = {
  all: starWarsNames,
  random: random
};

function random(number) {
  if (number === undefined) {
    return getRandomItem();
  } else {
    var randomItems = [];
    for (var i = 0; i < number; i++) {
      randomItems.push(getRandomItem());
    }
    return randomItems;
  }
}

Fix random with a number issue
fix(random): Fix random with a number issue

It was returning an array of empty values because I have no idea how to program :-(
