Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
The stupid question is the question not asked
 
PerlMonks  

Re: Random numbers generator

by Anonymous Monk
on Feb 07, 2001 at 20:20 UTC ( #56986=note: print w/ replies, xml ) Need Help??


in reply to Random numbers generator

I believe that, for diffrent results on diffrent machine, you can base your random generation upon a timer..
do depending on the time of your server the random number is generated.
The timer is the same once each day.. :)
I've done this a lot in VB dunno how in Perl..

# VB Code in here RANDOMIZE(Timer) N = INT(RND * 10)
I will be flamed.. :)


Comment on Re: Random numbers generator
Download Code
Re(2): Random numbers generator
by yakko (Friar) on Feb 07, 2001 at 21:21 UTC
    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.

      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://56986]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (14)
As of 2014-04-18 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (469 votes), past polls