[Top][All Lists]

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

$RANDOM is never equal to the next $RANDOM

From: zavandi
Subject: $RANDOM is never equal to the next $RANDOM
Date: Mon, 7 Mar 2005 14:23:44 +0200

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include
-I./lib-D_FILE_OFFSET_BITS=64 -O2 -g -pipe -m32 -march=i386
uname output: Linux localhost.localdomain 2.6.10-1.770_FC3#1 Thu Feb
24 14:00:06 EST 2005 i686 athlon i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu

Bash Version: 3.0.Patch Level: 14
Release Status: release


        This report seems related to my previous bug report (which I've been
told was already fixed), but this one doesn't involve subshells, so I
believe it's a different problem.



        last=-1; for (( i=1; i< 100000; i++ )); do curr=$RANDOM; if [ $curr
-eq $last ]; then echo OK; fi; last=$curr; done

        or maybe this shorter one:

        for (( i=1; i< 100000; i++ )); do if [ $RANDOM -eq $RANDOM ]; then
echo OK; fi; done

        They should be printing a few OKs, but none of them _ever_ prints
anything for me.

reply via email to

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