Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

(tye)Re: Everything gets output twice

by tye (Sage)
on May 21, 2001 at 21:25 UTC ( #82019=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Everything gets output twice
in thread Everything gets output twice

Actually, the most common problem with doubled output and fork is when the stdio buffers are copied by the fork. In that case, you'd get the same number as the call to rand would have happened before the fork.

Also, fork duplicates the whole process including the current seed used by rand, so even if the fork happened before the call to rand, you'd get the same number in both processes unless you managed to get Perl's implicit use of srand to happen after the fork.

        - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2022-12-10 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?