Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Thanks for all the replies.

I must admit, I had overlooked using the template or suffix options that File::Temp offers by default.

I do have calls to rand in other parts of the code (and calls to File::Temp prior to the fork()s), but I was just a little surprised that exactly the same sequences were occurring across so many processes.

dws suggests that calling srand in each child will re-seed the rand function - I'll give that one a shot too, although I did find the warning in the perldoc for 5.6.1 a little concerning:

Do not call srand multiple times in your program unless you know exactly what you're doing and why you're doing it.
...and I wasn't completely sure what I was doing :-)
The docs with 5.8.x aren't quite so stern.

Cheers,

BazB.


If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
That way everyone learns.


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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found