> David,
> 
> How did you get the RANDOM to produce random numbers
> if it's running in its own process?
> 
> I ran this in UWIN-VI HQ 4.5/6.0 2009-08-14 i686 i686 32/64 UWIN
> and had to take the RANDOM clause out of the bg process to have it
> not repeat the same result.
> 
> for i in {1..10}; do
>      { r=$((1+(RANDOM%8))); sleep $r; exit $r;} &
> done; wait
> 
> for i in {1..10}; do
>      r=$((1+(RANDOM%8))); { sleep $r; exit $r;} &
> done; wait
> 
> 
> 

Good question.

If I remember correctly, ksh calls the random number generator before each
fork so that each child will inherit a different starting point.

It also used the pid to initialized the random number generator
on each ksh startup.

David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to