Addendum: See BrowserUk's reply for a more tidy/efficient method of extracting the element from the arrayuse strict; my $max = 200; #number of elements for +array my @array = (0..$max-1); #initialize array while(@array !=0){ my $index = rand @array; #pick a random element o +f the existing array my $element = $array[$index]; #extract the element my @newarray = grep {$_ !=$element} @array; #remove the element @array = @newarray; #reset the array }
In reply to Re: random number
by insensate
in thread random number
by huskey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |