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

Re: Random Number Generator

by RichardK (Priest)
on Aug 20, 2013 at 10:10 UTC ( #1050169=note: print w/ replies, xml ) Need Help??


in reply to Random Number Generator

What made you think the rand function is time based?

Try adding srand(1000) to the start of your code and see what happens. You're just wasting time with those usleeps.

Designing a good random number generator isn't easy, so it's better to use one of the RNG modules that has been properly tested. see rand for some suggestions.

The maths behind random number generators and their proper testing is really interesting and well worth some study, if you have the time.


Comment on Re: Random Number Generator
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-09-19 00:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (128 votes), past polls