Generate random value with a distance between them

If you do it wrong you can get stuck in a loop for some time.

Great advice!

Except that other bad things can happen if you "do it wrong".