My current JavaScript code selects a random song from the assets/music folder and plays it:
audio.src = path + 'assets/music/'+(Math.floor(Math.random() * songs) + 1)+'.mp3'
However, I've noticed that sometimes the same track is played twice in a row, which is less than ideal.
Do you have any alternative solutions for this issue?
Visit my website at: The JavaScript code can be found here: