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

Re: Generating Repeatable Pseudorandom Sequences

by thinker (Parson)
on Sep 04, 2002 at 18:34 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-19 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found