in reply to Simulating Drawing From A Bag
Whereas a closer simulation of drawing random numbers from a bag would be through a subroutineperl -MList::Util=shuffle -le 'print join $/, shuffle 1 .. 10'
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.sub bag_draw { my $bag = shift; return splice(@$bag, rand(@$bag), 1); }
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Simulating Drawing From A Bag
by YAFZ (Pilgrim) on Jun 12, 2003 at 10:55 UTC |