You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test2::Plugin::SRand assumes that it can set srand() to get deterministic testing. This breaks the behavior of rand() and fork(). As of 5.37.x there is a new env var which should be used instead PERL_RAND_SEED, which behaves correctly with fork.
notice that calling srand() explicitly results in the child processes getting the same srand() state, whereas using PERL_RAND_SEED is deterministic but ensures each child process has its own seed.
I'd say that Test2::Plugin::SRand breaks anything that uses fork and rand() which does not itself use srand() explicitly.
The text was updated successfully, but these errors were encountered:
The "broken" behavior is exactly as expected and if I am not mistaken documented. It may not be ideal in 5.37.x and above, and that should be documented as well now.
Apart from documenting the "better" solution, what fix would you propose?
Test2::Plugin::SRand assumes that it can set srand() to get deterministic testing. This breaks the behavior of rand() and fork(). As of 5.37.x there is a new env var which should be used instead PERL_RAND_SEED, which behaves correctly with fork.
versus this:
notice that calling srand() explicitly results in the child processes getting the same srand() state, whereas using PERL_RAND_SEED is deterministic but ensures each child process has its own seed.
I'd say that Test2::Plugin::SRand breaks anything that uses fork and rand() which does not itself use srand() explicitly.
The text was updated successfully, but these errors were encountered: