Why not just
while (@my_bag > 0) { $x = int(rand(@my_bag)); print splice(@my_bag, $x, 1) . "\n"; }
This avoids the problem that Skeeve has pointed out.
In reply to Re: Simulating Drawing From A Bag
by Bilbo
in thread Simulating Drawing From A Bag
by YAFZ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |