JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" value="Random" onclick="fn()">

JavaScript

fn = function ()
{
var links = ["https://google.com", "https://yandex.ru", "https://wikipedia.org"];
var num = Math.floor(Math.random() * (2 - 0 + 1)) + 0;
window.open(links[num],"_blank");
}