Switching Screens Using Varibles

How do I switch a screen to another with a cariable that was chosen from a randomizer?

You save the variable to a localstorage and you get it from the same localstorage with the same key on the new screen