in reply to Generating same seed between 2 processes
Here is the Makefile:
> cat Makefile SEED := ${shell perl -e 'print int rand 10_000'} .EXPORT_ALL_VARIABLES: .PHONY: all all: @perl proc0 @perl proc1
Here is the 1st script:
> cat proc0 use warnings; use strict; if (exists $ENV{SEED}) { srand $ENV{SEED}; } else { die "Error: need a seed.\n"; } print "$0 ", rand, "\n";
Here is the 2nd script:
> cat proc1 use warnings; use strict; if (exists $ENV{SEED}) { srand $ENV{SEED}; } else { die "Error: need a seed.\n"; } print "$0 ", rand, "\n";
Now run it a few times:
> make proc0 0.0394185183840854 proc1 0.0394185183840854 > make proc0 0.821407354044826 proc1 0.821407354044826 > make proc0 0.697487873098911 proc1 0.697487873098911
|
|---|