in reply to Random Sampling
while ( @results < $num ) { if ( (@$array - $pos) * rand() < $num - @results ) { push @results, $array->[$pos]; } $pos++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Random Sampling
by demerphq (Chancellor) on Jun 26, 2002 at 17:02 UTC |