Is there any way to generate random number within a range? I'm making a shuffle function for my audio player using React. I got my song.id
works well. Once a random number is "used" I don't want it again.
But I want to randomly generate a number start with 0 and end with 51 (it can generate 0 and 51). I tried these but I keep getting dupes:
Math.floor(Math.random() * 52))