Do you know where your variables are? PerlMonks

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

by thor (Priest)
 on Jul 11, 2003 at 18:55 UTC ( #273530=note: print w/replies, xml ) Need Help??

There's predictability and there's predictibility. It tends to be bad for simulations if your "random" numbers start being the same on every pass through the main loop.
It all depends on the application. Perhaps you are looking for something in a large set with a certain property. So, rather than iterate through, you pick a random starting point. IIRC, there are non-deterministic primality tests that take a random input and tell you whether a number is composite or not. In this case, you want to keep the one random input that tells you that the number under examination is composite if you want to prove it. If I can find an example of such an algorithm later, I'll update this node.
Entropy measures the number of possible states of a system. Determinism is about the transitions between states. The two concepts are largely orthogonal.
Yes. However, this does not contradict anything that I said. Some people were concerned about repeated calls to rand() reducing the strength of randomness of data received from places like /dev/rand and such. I was saying that this was not the case, as perl uses a PRNG, which given a specific input is completely deterministic.

thor

Update: Check this out.

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

Replies are listed 'Best First'.
Re: Re: Re: Re: Can I seed srand() with results from rand()?
by Anonymous Monk on Jul 11, 2003 at 20:08 UTC
> Some people were concerned about repeated calls to rand()

I believe the issue was srand().

> I was saying that this was not the case, as perl uses a PRNG, which given a specific input is completely deterministic.

You seem to think that deterministic steps never reduce the entropy of the system. That is not true. Perhaps you meant "reversible"? rand() is commonly reversible, but srand() can't be.

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://273530]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2022-11-29 02:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My favourite new Perl feature (in 2022) ...

Results (41 votes). Check out past polls.

Notices?