From owner-freebsd-arch Mon Feb 26 20:27: 3 2001 Delivered-To: freebsd-arch@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 758) id 5802637B401; Mon, 26 Feb 2001 20:27:01 -0800 (PST) Date: Mon, 26 Feb 2001 20:27:01 -0800 From: Kris Kennaway To: Terry Lambert Cc: "Jacques A. Vidrine" , Kris Kennaway , arch@FreeBSD.ORG Subject: Re: rand(3) (was Re: cvs commit: ports/astro/xglobe/files patch-random) Message-ID: <20010226202701.A13175@hub.freebsd.org> References: <20010226211804.A44846@spawn.nectar.com> <200102270400.VAA11366@usr05.primenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200102270400.VAA11366@usr05.primenet.com>; from tlambert@primenet.com on Tue, Feb 27, 2001 at 04:00:22AM +0000 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Feb 27, 2001 at 04:00:22AM +0000, Terry Lambert wrote: > > > > Why do you expect this anyway? > > > > > > I am a scientist. Repeatability of experiments is important. > > > > I meant: Why do you expect that, for example, Solaris's rand() > > implementation would give the same results as FreeBSD's rand() > > implementation, or that on any other platform? The algorithm > > is not specified by ISO C, nor by POSIX, nor by SUSv2. > > [ ... ] > > > The implication being, of course, that if you want your results to be the same > > across platforms, than you need to provide your own PRNG instead of using > > rand(). > > The 48 bit linear congruential algorithm is a defacto standard for > the implementation across UNIX platforms. While the standards do > not specify this algorithm, in practice it is there, just as, in > practice, select() does not modify the contents of timeval, even > though the man page permits it to do so, since code would break. Don't know where you're pulling 48-bits from (though I have my suspicions :-) but it's not rand() you're talking about (rand is a 32 bit LCRNG). > Can someone put forth a use for rand() which requires this change > to permit the use to employe rand() instead of its own code? Parse error. Kris -- In God we Trust -- all others must submit an X.509 certificate. -- Charles Forsythe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message