bug-bash
[Top][All Lists]
Advanced

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

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" <address@hidden> 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



reply via email to

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