My purpose is to obtain a random number when a condition of proximity is fulfilled. But only once, and maintain that value while the condition is true. Then, when the condition becomes not true and after that, true again, make the same operation, I mean, obtain another random value.
But as a code say more than 1000 explanation... here is it: