Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Nov 2001 14:10:23 -0500
From:      "Gerald T. Freymann" <freymann@scaryg.shacknet.nu>
To:        "Andre` Niel Cameron" <AndreC@Axxs.net>, "free bsd" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Perl Question
Message-ID:  <026001c16bad$ae034a50$0f01a8c0@phantom>
References:  <00b801c16baa$6f4bde60$a50410ac@olmct.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> Anyone know how to generate a random number in perl so I can stick it in
a
> variable?

 How about:

$myvar = rand(10);

where 10 is the highest number to use, so $myvar would come back as a
random number between 0 and 10.

OR:

$myvar = srand(value);

srand accepts an integer value as an arguement; if no arguement is
supplied, srand calls the time function and uses its return value as the
random-number seed.

gf



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?026001c16bad$ae034a50$0f01a8c0>