FOREACH, FOR, IF loops are perfectly suitable if you put error handling into your script (which you should).
Global variables are shared across all threads, while the local variable is only within the current thread. If you request a value at the beginning of your thread, it will remain the same during the whole lifespan of that thread unless otherwise specified. For example, you could generate a few of them in a loop, save to list, then you have multiple random numbers to choose from.