Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Feb 2001 02:41:22 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        kris@obsecurity.org (Kris Kennaway)
Cc:        arch@FreeBSD.ORG
Subject:   Re: cvs commit: ports/astro/xglobe/files patch-random
Message-ID:  <200102260241.TAA07028@usr05.primenet.com>
In-Reply-To: <20010225005813.A29124@mollari.cthul.hu> from "Kris Kennaway" at Feb 25, 2001 12:58:13 AM

next in thread | previous in thread | raw e-mail | index | archive | help
> > 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102260241.TAA07028>