Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Can I seed srand() with results from rand()?

by mp (Deacon)
on Jul 10, 2003 at 15:20 UTC ( [id://273013]=note: print w/replies, xml ) Need Help??


in reply to Can I seed srand() with results from rand()?

This thread and its conclusion both dealing with a similar problem of producing repeatable pseudorandom sequences might be helpful to you. I used Math::Random::MT to generate random numbers and seeded it deterministically to get repeatable sequences without touching srand(), since srand()'s seed may have been depended on in other unrelated parts of the application (where less deterministic behavior was needed).

Math::Random::MT keeps the seed state in an object instance, so it makes for easy construction of multiple deterministic pseudorandom sequence generators.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-03-19 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found