http://www.perlmonks.org?node_id=981301


in reply to Re: biased random number picking
in thread biased random number picking

the slice is expensive and not really required:
my $choice = int(rand($#options + 1)); say 'Choice #', $_, ' is ', $options[$choice]; $options[$choice] = $options[-1]; pop @options;