JavaScript – switch condition returning array

Depending on the input, the function should return an array of ‘num’ elements ranging from ‘start’ to ‘end’. The ‘type’ argument determines whether they should be integers (‘1’) or floating point (‘0’).
First a new array of ‘num’ length is created and then there’s a switch statement to determine if it should be integers or decimal numbers generated.
I seem to be having problems with returning them. The functions generating random numbers I have taken from Mozilla’s developer website. The whole think will be feed in React Native’s action creator but I don’t think that’s relevant here.

export const genNum = (start, end, num, type) => {
  let numberArray = new Array(num);

  switch (type) {
    case 1:
      return numberArray.map(function(num) {
        let min = Math.ceil(start);
        let max = Math.floor(end);
        return Math.floor(Math.random() * (max - min)) + min;
      });
    default:
      return numberArray.map(function(num) {
        return Math.floor(Math.random() * (max - min)) + min;
    });
  }
};


Source: stackoverflow-javascript