Peng,
Could you give me an example code? I want to randomly select X numbers of
numbers from the @nums list. For instance, i want to randomly select 3 numbers
from @nums i.e. 10000, 10005, 140000. How would you use srand to do this?
Would Math::TrulyRandom be a better solution since i want to use this function
to randomly pick winners for a drawing contest. If so could some one kindly
give me some example codes? Thanks.
#!/usr/bin/perl
use strict;
use warnings;
my @nums = ("10000","10002","10004","10005","10006","140000","1500000");
my $randnum = $nums[rand(@nums)];
print "$randnum \n";
--- On Mon, 7/28/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Subject: Re: rand()
To: [EMAIL PROTECTED]
Cc: [email protected]
Date: Monday, July 28, 2008, 9:06 AM
On Mon, Jul 28, 2008 at 10:54 PM, Bobby <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> How do I use the rand function to print out more than one random number
for an array? In the example script below i have an array @nums with a list of
numbers; how do i print out more than one random numbers from that list
(@nums)? Thanks.
>
You may need srand before the rand function.
--
Regards,
Jeff. - [EMAIL PROTECTED]