How do i randomise screens without repeats?
best way of doing it is stetting up an array with the listed screens, when a specific index of a screen is picked use Array.splice
to remove it and then continue picking
var screens = ["screen1", "screen2", "screen3"];
function pickScreen() {
var index = randomNumber(0, screens.length - 1);
setScreen(screens[index]);
screens.splice(index, 1);
}
this should be the easiest solution i could come up with offhand
1 Like