Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Feb 2001 20:27:01 -0800
From:      Kris Kennaway <kris@FreeBSD.org>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        "Jacques A. Vidrine" <n@nectar.com>, Kris Kennaway <kris@FreeBSD.ORG>, arch@FreeBSD.ORG
Subject:   Re: rand(3) (was Re: cvs commit: ports/astro/xglobe/files patch-random)
Message-ID:  <20010226202701.A13175@hub.freebsd.org>
In-Reply-To: <200102270400.VAA11366@usr05.primenet.com>; from tlambert@primenet.com on Tue, Feb 27, 2001 at 04:00:22AM %2B0000
References:  <20010226211804.A44846@spawn.nectar.com> <200102270400.VAA11366@usr05.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <forsythe@alum.mit.edu>

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?20010226202701.A13175>