Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by mp (Deacon)
on Jul 10, 2003 at 15:20 UTC ( #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.

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

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 about the Monastery: (3)
As of 2023-12-11 01:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?