Source : Shivam Arora var randomNumberBetweenXandY = (x,y) => Math.floor(Math.random() * ((y-x)+1) + x);