Hi,

I'm using Bash's $RANDOM variable to create repeatable sequences of
pseudo-random numbers. I used seeds >= 0, and noticed random
non-repeatable sequences for RANDOM=0, which I didn't expect given the
documentation.

Looking at the code, it appears that RANDOM=0 has a specific value,
which appears to be “seed not initialised,” and triggers an
initialisation on the next call. I think this characteristic has to be
made explicit in the documentation, to avoid bad surprises.

How about this hand made diff

       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.
+              initialized by assigning a value larger than 0 to RANDOM.  A
+              value of 0 would reset the seed to the current time at which the
+              next number is requested.  If RANDOM is unset, it  loses  its
+              special properties,  even if it is subsequently reset.

for the man page (and similar for the other formats)?

Please Cc me on any answer as I'm not subscribed to this list.

-- 
Olivier Mehani <sht...@ssji.net>
PGP fingerprint: 4435 CF6A 7C8D DD9B E2DE  F5F9 F012 A6E2 98C6 6655

Attachment: pgpb0Htach4xV.pgp
Description: Cryptographic signature

Reply via email to