FW: Scripts picks random elements from array , but it repeats sometimes

2002-04-29 Thread FLAHERTY, JIM-CONT

 
Hello , My script picks out random elements from an array , but it sometimes
repeats ( which is no good) .. I want to prevent this , Do I delete the
element from the array  or is there a better way ? And how do I do
either ?  
 
 
 
my mistake here is the code 
 
 
 
 
while($numofques > 0) {
$index   = rand @numbers;
$element = $numbers[$index];
 
 
 

 
 
 
 
 
Thanks 
Jim



Re: FW: Scripts picks random elements from array , but it repeats sometimes

2002-04-29 Thread John W. Krahn

Jim-Cont Flaherty wrote:
> 
> Hello , My script picks out random elements from an array , but it sometimes
> repeats ( which is no good) .. I want to prevent this , Do I delete the
> element from the array  or is there a better way ? And how do I do
> either ?
> 
> my mistake here is the code
> 
> while($numofques > 0) {
> $index   = rand @numbers;
> $element = $numbers[$index];


while ( @numbers ) {
$element = splice @numbers, rand @numbers, 1;


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]