From owner-freebsd-test Sun Nov 11 13:40:31 2001 Delivered-To: freebsd-test@freebsd.org Received: from dadesf.com (dsl-64-34-181-105.telocity.com [64.34.181.105]) by hub.freebsd.org (Postfix) with ESMTP id 6D0A437B416 for ; Sun, 11 Nov 2001 13:40:23 -0800 (PST) Received: from berloga (IDENT:devotee@localhost.localdomain [127.0.0.1]) by dadesf.com (8.11.2/8.11.2) with SMTP id fABLaM817707; Sun, 11 Nov 2001 13:36:22 -0800 Received: (nullmailer pid 2234 invoked by uid 1000); Sun, 11 Nov 2001 21:40:09 -0000 Date: Sun, 11 Nov 2001 23:40:09 +0200 From: devotee To: freebsd-test@freebsd.org Subject: strange rand() behaviuor Message-ID: <20011111234009.A2197@berloga.volodya.artm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.22.1i X-Disclaimer: Stop dictatorship in Belarus ! Sender: owner-freebsd-test@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, list ! My old RSA-code failed to work in proper maner under FreeBSD 4.4. I spent 2 hours, and it seems FreeBSD version of rand() or libc or gcc or whatever have some bugs in it. Here's sample code: #include int main () { int i,j; for (i=0; i<256*10; i++) { j = rand(); if (!(i%256)) printf ("i=%5d j=0x%08X j%%256=0x%02X\n",i,j,j%256); } return 0; } It just prints each 256th random number from rand(); Here's my output: bash-2.05$ gcc randtest.c -o randtest bash-2.05$ ./randtest i= 0 j=0x41C67EA6 j%256=0xA6 i= 256 j=0x32AA09A6 j%256=0xA6 i= 512 j=0x559994A6 j%256=0xA6 i= 768 j=0x5A951FA6 j%256=0xA6 i= 1024 j=0x719CAAA6 j%256=0xA6 i= 1280 j=0x4AB035A6 j%256=0xA6 i= 1536 j=0x15CFC0A6 j%256=0xA6 i= 1792 j=0x02FB4BA6 j%256=0xA6 i= 2048 j=0x4232D6A6 j%256=0xA6 i= 2304 j=0x037661A6 j%256=0xA6 As you can see, last octet of each rand value is the same !!! Under debian linux same code outputs: devotee@nerve:~$ gcc randtest.c -o randtest devotee@nerve:~$ ./randtest i= 0 j=0x6B8B4567 j%256=0x67 i= 256 j=0x5D888A08 j%256=0x08 i= 512 j=0x4695AE95 j%256=0x95 i= 768 j=0x2C06DCF3 j%256=0xF3 i= 1024 j=0x170EB52B j%256=0x2B i= 1280 j=0x22317590 j%256=0x90 i= 1536 j=0x1E1C83A1 j%256=0xA1 i= 1792 j=0x3F754C7B j%256=0x7B i= 2048 j=0x10A93FB7 j%256=0xB7 i= 2304 j=0x12130ECA j%256=0xCA (that's what i expected to see under freebsd) What's wrong ??? -- devotee, http://volodya.artm.org Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-test" in the body of the message From owner-freebsd-test Wed Nov 14 14:39:42 2001 Delivered-To: freebsd-test@freebsd.org Received: from mailrelay3.inwind.it (mailrelay3.inwind.it [212.141.54.103]) by hub.freebsd.org (Postfix) with ESMTP id 58C6B37B405 for ; Wed, 14 Nov 2001 14:39:40 -0800 (PST) Received: from localhost (62.98.162.130) by mailrelay3.inwind.it (5.5.029) id 3BDECF6500638A88 for freebsd-test@freebsd.org; Wed, 14 Nov 2001 23:39:35 +0100 From: Salvo Bartolotta Date: Wed, 14 Nov 2001 21:42:27 GMT Message-ID: <20011114.21422700@localhost.> Subject: TEST To: freebsd-test@freebsd.org X-Mailer: SuperCalifragilis X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: owner-freebsd-test@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG TEEEEEEEEEEEEEEEEEST! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-test" in the body of the message From owner-freebsd-test Fri Nov 16 13:50: 1 2001 Delivered-To: freebsd-test@freebsd.org Received: from users.symmetric.net (centipede.symmetric.net [63.150.23.120]) by hub.freebsd.org (Postfix) with ESMTP id 23C8537B418 for ; Fri, 16 Nov 2001 13:49:58 -0800 (PST) Received: by users.symmetric.net (Crow Mail v6.7, from userid 1000) id 888F51B269; Fri, 16 Nov 2001 15:49:52 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by users.symmetric.net (Crow Mail v6.7) with ESMTP id 87A43D972 for ; Fri, 16 Nov 2001 15:49:52 -0600 (CST) Date: Fri, 16 Nov 2001 15:49:52 -0600 (CST) From: presence X-X-Sender: To: Subject: hmm Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-test@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG what does this do? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-test" in the body of the message