in reply to removing the goto
I noticed he was randomizing the array, then selecting random indices from there, which was not only reduntdant but created the issue of potentially selecting the same element.use List::Util 'shuffle'; my %unique = map { $_ => 1 } @weighteddiv; my @shuffled = shuffle(keys %unique); @selected = @shuffled[0..4];
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: removing the goto
by jdporter (Paladin) on Jun 01, 2007 at 18:27 UTC | |
by imp (Priest) on Jun 01, 2007 at 18:43 UTC |