Randomise youtube link to play in an embedded video
<pre><code>$("#video").attr('src', idea(ads));
$(".heading").text(idea(ads));
var ads = ["https://youtu.be/nSZtxXNjmLA", "https://www.youtube.com/watch?v=D2pOkm4opVU"]; 
function idea(el) {
    return el[Math.floor(Math.random() * el.length)];
}
</code></pre>

<p>So I am using the function idea to randomise it. The iframe has an id of video.</p>