Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Poor randomness with File::Temp and fork().

by Joost (Canon)
on Jun 27, 2004 at 17:14 UTC ( [id://370004]=note: print w/replies, xml ) Need Help??


in reply to Re: Poor randomness with File::Temp and fork().
in thread Poor randomness with File::Temp and fork().

If you are calling srand() before forking (or not calling srand) then the children have the same random seed as they start
Actually, if you don't call srand at all, the children will have different seeds as long as you don't call rand() before the fork() either (since perl 5.004). See perldoc -f srand:
If srand() is not called explicitly, it is called implicitly at the first use of the "rand" operator.
In this case, it's probably safest to call srand after the fork() anyway.

  • Comment on Re^2: Poor randomness with File::Temp and fork().

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-25 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found