For this to work I think it would work similar to the shuffle random math code.
This:
function newRandomNumber(min, max) {
return Math.floor(Math.random() * max) + min;
}
I came up with this way, not sure if that is good, or if it can be improved, or maybe that is a terrible way to do it.
How it works is, the blue play image is clicked, then one of the 3 videos starts to play.
https://jsfiddle.net/tgyzsp97/
const videos = thewrap.querySelectorAll("div.jacket");
const random = Math.floor(Math.random() * videos.length);
videos[random].click();
javascript:
function coverClickHandler(evt) {
const cover = evt.currentTarget;
hide(cover);
const thewrap = cover.parentElement.querySelector(".container");
show(thewrap);
const videos = thewrap.querySelectorAll("div.jacket");
const random = Math.floor(Math.random() * videos.length);
videos[random].click();
}
const cover = document.querySelector(".play");
cover.addEventListener("click", coverClickHandler);
}());