good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: random number with rangeby GrandFather (Saint) |
on Jun 01, 2006 at 17:34 UTC ( [id://553097]=note: print w/replies, xml ) | Need Help?? |
Just use the rand function. It generates numbers in a half open interval ranging from (and including) 0 through to (but not including) the positive number given (or 1 if omited). The result is a real number (not an integer) in that range. If you want to pick an integer between $start and $end inclusive you can do this:
$end must be >= $start. DWIM is Perl's answer to Gödel
In Section
Seekers of Perl Wisdom
|
|