Say I have 5 variables:
$a=2
$b=0
$c=7
$d=0
$e=3
I want to choose one variable randomly that is not zero, do something with it, then set that chosen variable to zero.
Note that I want to know which variable is chosen, for example if I got 7 I want to also know that it's $c, so that I can change its value after reading it.
What is the simplest way to do that?
I was thinking take all variables then randomize first, then check if it's zero, but it doesn't scale well if I had more variables and more zeroes.