Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re(2): Random numbers generator

by yakko (Friar)
on Feb 07, 2001 at 21:21 UTC ( #56995=note: print w/ replies, xml ) Need Help??

in reply to Re: Random numbers generator
in thread Random numbers generator

Have a look at srand and rand. That block translates pretty well into perl:

srand; my $n=int(rand(10)); # gets you a number 0..9

Me spell chucker work grate. Need grandma chicken.

Comment on Re(2): Random numbers generator
Download Code
Replies are listed 'Best First'.
Re: Re(2): Random numbers generator
by davorg (Chancellor) on Feb 07, 2001 at 21:23 UTC

    srand is only required if your script is running on a version of Perl earlier than 5.004.


    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me

      Yes. There is an excellent explanation of Perl's random seed here. (for 5.004 and up)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://56995]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2016-02-10 23:16 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (354 votes), past polls