Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Non-Repetitive Random Numbers

by 2teez (Priest)
on Apr 05, 2013 at 05:42 UTC ( #1027066=note: print w/ replies, xml ) Need Help??


in reply to Non-Repetitive Random Numbers

Please take a look at perl function srand.
This function "seed" the rand function so that rand can produce a different sequence each time you run your program.

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re: Non-Repetitive Random Numbers
Replies are listed 'Best First'.
Re^2: Non-Repetitive Random Numbers
by dsheroh (Parson) on Apr 05, 2013 at 10:04 UTC
    Please take another look at the documentation you linked to.

    The docs for rand state that it "Automatically calls srand unless srand has already been called." It is not necessary to call srand manually and doing so may actually reduce the randomness of the sequence your receive. (If you call srand repeatedly, it will almost certainly do so.)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2015-07-08 06:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls