I need help understanding the Bash manual page:

RANDOM Each time this parameter is referenced, a random integer between
       0 and 32767 is generated.  The sequence of random numbers may be
       initialized by assigning a value to RANDOM.  If RANDOM is unset,
       it  loses  its  special  properties,  even if it is subsequently
       reset.

The Korn shell has the same manual page statement, more or less.

This is the current behavior:

$ RANDOM=1
$ echo $RANDOM
16838
$ echo $RANDOM && echo $RANDOM
8312
20622
$ RANDOM=1
$ echo $RANDOM
16838

I don't understand "If RANDOM is unset, it  loses  its  special  properties,  
even if it is subsequently reset.". From what I see of the behavior, $RANDOM 
is not random if you initialize it yourself, but neither is any pseudo random 
number generator. What I'm wondering is whether the "seed" should be saved 
only for the session, so that 'RANDOM=1 ; echo $RANDOM' is not the same in 
every session... that the old seed is lost forever if RANDOM is 
reinitialized.

It's easy to change Bash to make $RANDOM random whether you initialize it or 
not (the initialization would actually be ignored). Is there any practical 
use for having 'RANDOM=1 ; echo $RANDOM' the same on every system? If $RANDOM 
is going to actually be random, then the manual page needs to be modified to 
reflect that.

robert

Attachment: pgpACBqWilf0S.pgp
Description: PGP signature

-- 
http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to