র্যান্ডমলি প্লে করতে গানগুলো নিচের মত যোগ করুন:
init([
'https://demo.com/songs/song1.mp3',
'https://demo.com/songs/song2.mp3',
'https://demo.com/songs/song3.mp3'
]);
Math.random ব্যবহার করে র্যান্ডমলি প্লে করতে:
function displayRandom() {
var audio = Math.floor(Math.random() * (collection.length));
audio = collection[audio];
audio.play();
setTimeout(loop, audio.duration * 1000);
}