From owner-freebsd-current Sun Feb 2 16:38:39 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BEE3A37B401 for ; Sun, 2 Feb 2003 16:38:37 -0800 (PST) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3FB5843F43 for ; Sun, 2 Feb 2003 16:38:37 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from pool0402.cvx21-bradley.dialup.earthlink.net ([209.179.193.147] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 18fUd6-0007eb-00; Sun, 02 Feb 2003 16:38:32 -0800 Message-ID: <3E3DB9B3.A233B848@mindspring.com> Date: Sun, 02 Feb 2003 16:37:07 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Steve Kargl Cc: Bakul Shah , Mark Murray , current@FreeBSD.ORG Subject: Re: rand() is broken References: <200302022106.h12L6naX051530@grimreaper.grondar.org> <200302022159.QAA13933@wellington.cnchost.com> <20030202223725.GA72744@troutmask.apl.washington.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a474d2a290bd18d30ead75475d716045a2a7ce0e8f8d31aa3f350badd9bab72f9c350badd9bab72f9c Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Steve Kargl wrote: > I was going to stay out of this, but > > #include > #include > int main(void) { > int i; > long x; > x = 100L; > srandom(x); > for (i = 0; i < 1010; i++) { > x = random(); > printf("%ld\n", x); > } > return 0; > } > > Last 10 digits. > > FreeBSD Redhat SunOS > 660787754 660787754 645318364 > 327548691 327548691 1583150371 > 2009993994 2009993994 715222008 > 1653966416 1653966416 1349166998 > 1074113008 1074113008 566227131 > 2142626740 2142626740 1382825076 > 1517775852 1517775852 583981903 > 1453318125 1453318125 1453942393 > 619607807 619607807 1952958724 > 199986393 199986393 1599163286 386BSD 0.1+ patchkit TRU64 660787754 660787754 327548691 327548691 2009993994 2009993994 1653966416 1653966416 1074113008 1074113008 2142626740 2142626740 1517775852 1517775852 1453318125 1453318125 619607807 619607807 199986393 199986393 I can fire up my HP/UX and SunOS 4.1.3-U1 boxes too, if you need those, but I'm pretty sure the reason you got a different answer for newer Solaris was because it uses the SVR4 code, instead. The *48() functions are also identical (linear congruential); I used to use them for physics simulations. The f2c compiler did not have the functions until I personally added them to the library. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message