Re: RANDOM not random under bash 2.04.11(1)-release
From:
Paul Jarc
Subject:
Re: RANDOM not random under bash 2.04.11(1)-release
Date:
Tue, 24 Jul 2001 15:27:42 -0400
User-agent:
Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7
"Todd A. Jacobs" <tjacobs@codegnome.org> writes:
> The following command *always* returns values 0..3 in numerical order, no
> matter how many times it's called:
>
> echo $(( $RANDOM % 4 ))
Many PRNGs give predictable sequences in the low-order bits. Use the
high-order bits instead: echo $(( $RANDOM >> 13 ))
paul