On various platforms, with versions of bash from 1.14 to 3.0, I
get:
$ RANDOM=1234567890; echo $RANDOM
2599
$ RANDOM=1234567890; echo $RANDOM
2599
That's as it should be. But when I put that in a subshell (2.05b
and 3.00):
$ ( RANDOM=1234567890; echo $RANDOM )
18681
$ ( RANDOM=1234567890; echo $RANDOM )
20498
$ ( RANDOM=1234567890; echo $RANDOM )
22315
Bash 1.14 (as well as pdksh and ksh93) produces the same number
every time.
Bash was changed at some point in the past to re-seed the random number
generator when a subshell was started, so the random sequence differed
in the parent and the subshell.
I have since made two changes that will address your concerns: the
rng is only re-seeded once per subshell, and assigning a value to
RANDOM in the subshell counts as re-seeding.
Chet