use List::Util shuffle; @weighteddiv = shuffle @weighteddiv; @selected = (); xyz: foreach $i (0..$maxclients-1) { if ($#weighteddiv > = 0) { $idx=int(rand($#weighteddiv)); $selected[$i] = $weighteddiv[$idx]; if ($i>0) { foreach $j (0..$i-1) { if ($selected[$i] == $selected[$j]) { redo xyz; } } } } }
In reply to Re^2: removing the goto
by ysth
in thread removing the goto
by scoobyrico
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |