in reply to Re: srand producing the same sequence of random numbers
in thread srand producing the same sequence of random numbers
The random number generator does not need to be re-seeded, ever, in normal practice.
Every interpreter needs to be seeded. Perl will do that automatically, except when the interpreter is cloned by fork.
$ perl -e' rand(10); if (my $pid = fork()) { waitpid($pid, 0); } local ($,, $\) = (", ", "\n"); print map int(rand(10)), 1..10; ' 8, 3, 9, 8, 8, 2, 3, 8, 4, 8 8, 3, 9, 8, 8, 2, 3, 8, 4, 8
|
|---|