bug-bash
[Top][All Lists]
Advanced

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

Re: $RANDOM bug


From: Paul Jarc
Subject: Re: $RANDOM bug
Date: 21 May 2001 13:29:33 -0400
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/20.7

Antoni Sawicki <address@hidden> writes:
> echo $(($RANDOM%2))
> 
> returns sequencial 0 and 1 and 0 and 1 and 0 and 1,

PRNGs' low-order bits are often fairly predictable.  Use the
high-order bits instead: $(($RANDOM>=16384))


paul



reply via email to

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