perchè tanto mi è bastato fare:

Math.floor(5 * Math.random()) + 1