const links = [ ... ]; document.getElementById("link_id").href = links[Math.floor(Math.random() * links.length)];