Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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.

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.

    --
    <http://www.dave.org.uk>

    "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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://56995]
help
Chatterbox?
[marinersk]: LanX, the problem is that the lack of interface visual stability is disconcerting to me. The Nodelet appearing and disappearing is distracting, and despite over a decade, still troubles me. It jangles me.
[LanX]: I see
[marinersk]: I appear to be unusually dependent on spacial stability. I have had trouble from someone moving an object a mere four inches to the left.
[Eily]: I think the solution is to write posts so brilliant that you gain XP on each refresh, no matter how often :P
[marinersk]: Eily++ and LOL
[marinersk]: I get a lighter version of this disconcertion (new word?) when the n points remaining until rank disappears.

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2017-05-29 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?