Re: rand()



Bobby wrote:
That helps but how would i just get back an X number of random numbers
because @nums could be in the hundreds of unique numbers. For instance,
i just want to randomly pickout 4 numbers from a long list of unique
numbers in @nums, how would i do that?

use List::Util qw' shuffle ';

my $X = 4;

my @random = ( shuffle @nums )[ 0 .. $X - 1 ];



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
.