in reply to Simulating Drawing From A Bag

What you're doing there could be reduced to
perl -MList::Util=shuffle -le 'print join $/, shuffle 1 .. 10'
Whereas a closer simulation of drawing random numbers from a bag would be through a subroutine
sub bag_draw { my $bag = shift; return splice(@$bag, rand(@$bag), 1); }
This way you can draw items from a 'bag' if and when you choose. You might also be interested in the set implementation on CPAN - Set::Bag.
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: Simulating Drawing From A Bag
by YAFZ (Pilgrim) on Jun 12, 2003 at 10:55 UTC
    Glad to see the one-liner :) I'll take a look at List::Util and Set::Bag.