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

Re: Generating Repeatable Pseudorandom Sequences

by thinker (Parson)
on Sep 04, 2002 at 18:34 UTC ( #195156=note: print w/replies, xml ) Need Help??


in reply to Generating Repeatable Pseudorandom Sequences

Hi mp,

All you have to do is call srand() with the same value every time. So use a constant, or even a literal, instead of a variable.

So, if your program begins srand(42), it will always return the same sequence of random numbers.

Hope this helps

thinker

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2023-02-04 22:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (31 votes). Check out past polls.

    Notices?