I feel I should preface this by saying I am just now really learning how to incorporate anything into JavaScript, so please explain things and answers at a rudimentary level.
I am trying to figure out how to make this script NOT REPEAT an option until ALL options have been exhausted at least once. This is a common problem with Math.random from what I see, but I have no idea how to incorporate a fix to make it not repeat.
var roulette = document.getElementById("rouletteButton");
var stratnames_t = {
'0': "Strategy 1 Name Here",
'1': "Strategy 2 Name Here",
};
var objectives_t = {
'0': "Objective 1 Description Here",
'1': "Objective 2 Description Here",
};
function randomRoulette() {
document.getElementById("roulette").style.display = "";
var rand = Math.floor(2 * Math.random());
document.getElementsByTagName("objective")[0].innerHTML = objectives_t[rand];
document.getElementsByTagName("stratname")[0].innerHTML = stratnames_t[rand];
};
function main() {
roulette.addEventListener("click", function() {
randomRoulette();
});
}
main();