in reply to Re: removing the goto
in thread removing the goto
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; } } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: removing the goto
by shmem (Chancellor) on Jun 01, 2007 at 19:14 UTC | |
by imp (Priest) on Jun 01, 2007 at 19:26 UTC | |
by shmem (Chancellor) on Jun 01, 2007 at 20:09 UTC |