From owner-freebsd-arch Sun Feb 25 18:41:52 2001 Delivered-To: freebsd-arch@freebsd.org Received: from smtp04.primenet.com (smtp04.primenet.com [206.165.6.134]) by hub.freebsd.org (Postfix) with ESMTP id E028B37B401 for ; Sun, 25 Feb 2001 18:41:49 -0800 (PST) (envelope-from tlambert@usr05.primenet.com) Received: (from daemon@localhost) by smtp04.primenet.com (8.9.3/8.9.3) id TAA27453; Sun, 25 Feb 2001 19:36:07 -0700 (MST) Received: from usr05.primenet.com(206.165.6.205) via SMTP by smtp04.primenet.com, id smtpdAAAUpaiD1; Sun Feb 25 19:35:55 2001 Received: (from tlambert@localhost) by usr05.primenet.com (8.8.5/8.8.5) id TAA07028; Sun, 25 Feb 2001 19:41:32 -0700 (MST) From: Terry Lambert Message-Id: <200102260241.TAA07028@usr05.primenet.com> Subject: Re: cvs commit: ports/astro/xglobe/files patch-random To: kris@obsecurity.org (Kris Kennaway) Date: Mon, 26 Feb 2001 02:41:22 +0000 (GMT) Cc: arch@FreeBSD.ORG In-Reply-To: <20010225005813.A29124@mollari.cthul.hu> from "Kris Kennaway" at Feb 25, 2001 12:58:13 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > No, the algorithm of rand() is not standardized in the C standard. > > > > OTOH, there is an example of a portable implementation of rand() in the > > C standard and FreeBSD uses the same algorithm (as does many other > > implementations of rand()). This is probably what you were thinking of. > > > > As long as rand() and srand() behaves as describe in the man-page for > > rand(3) they confirm to the C standard. (Provided that RAND_MAX is at > > least 32767.) > > That's good to know. I'll look at replacing it with something better > that has the same semantics, so we solve this problem at the source. Please do not. The 48 bit linear congruential algorithm is often used to creat pseudo one-time pads for ciphering data. Changing the algorithm will result in ciphered data becoming inaccesable. Repeatability of results in montecarlo based physics simulations is also an issue. FreeBSD would end up being much less useful for real numeric work, should rand() be changed. Ignoring that, what makes you think you can come up with a better algorithm than Donald Knuth? Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message