bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RANDOM not random under bash 2.04.11(1)-release


From: Todd A. Jacobs
Subject: RANDOM not random under bash 2.04.11(1)-release
Date: Tue, 24 Jul 2001 12:20:50 -0700 (PDT)

This problem was detected on a Pentium III running Red Hat Linux
2.2.19-7.0.8 and bash 2.04.11(1)-release.

The following command *always* returns values 0..3 in numerical order, no
matter how many times it's called:

        echo $(( $RANDOM % 4 ))

While the entrance into the series isn't always 0, once the loop has been
started, the numbers *always* follow in numerical sequence.

This also holds true for at least one other mod value: 2, which will
always return 0 and 1, in sequence.

-- 
Work: It's not just a job, it's an indenture.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]