in reply to shuffle in Parallel::ForkManager;

fork does not reset the seed that the rand function uses. This means that all forked children will generate the same (pseudo)random sequences and thus also will generate the same permutation from shuffle. Maybe calling srand helps?

Replies are listed 'Best First'.
Re^2: shuffle in Parallel::ForkManager;
by ikegami (Patriarch) on Apr 18, 2015 at 16:15 UTC
    Demo:
    $ perl -E' rand; my $pid = fork; srand if $ARGV[0]; say rand; waitpid($pid, 0); ' 0 0.458778299481736 0.458778299481736 $ perl -E' rand; my $pid = fork; srand if $ARGV[0]; say rand; waitpid($pid, 0); ' 1 0.656664192517386 0.153404296449484

    (The seed is determined the first time rand is called, so the problem only manifests itself if rand is called before fork.)