On Wed, 28 Nov 2001 12:46:06 -0600, [EMAIL PROTECTED] (Andy Bach)
wrote:
> Thanks much. I thought there might be related technique for getting a
> rand element from an array, but we know the array length so ... this
> (from above) did help w/ my getting all the elements in a random order, i.e.:
> while ( @arr ) {
> $pos = rand($#arr);
> $val = splice @arr, $pos, 1;
> print "is: $val\n";
> }
Obi-Wan error in there? I think you need rand(@arr), or you're never
going to get the last element (since rand($#arr) always is < $#arr).
Cheers,
Philip