Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Feb 2001 12:59:01 -0600
From:      "Jacques A. Vidrine" <n@nectar.com>
To:        "Andrey A. Chernov" <ache@nagual.pp.ru>
Cc:        Mark Murray <mark@grondar.za>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: rand.c patch for review (was: Re: cvs commit: ports/astro/xglobe/files patch-random)
Message-ID:  <20010225125901.A47165@hamlet.nectar.com>
In-Reply-To: <20010225213744.A57744@nagual.pp.ru>; from ache@nagual.pp.ru on Sun, Feb 25, 2001 at 09:37:44PM %2B0300
References:  <20010225193409.A56351@nagual.pp.ru> <200102251758.f1PHwuR02481@gratis.grondar.za> <20010225213744.A57744@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Feb 25, 2001 at 09:37:44PM +0300, Andrey A. Chernov wrote:
> On Sun, Feb 25, 2001 at 19:59:41 +0200, Mark Murray wrote:
> > > Patch for review:
> > 
> > Whats wrong with
> > 
> > int
> > rand(void)
> > {
> > 	return((int)random());
> > }
> > 
> > ??
> 
> 1) Seed & State. Even if srand() is backed by srandom(), if called
> independently, they overwrite each other seeding
> state. initstate() etc. adds more here.

Emphasis:  Standard C says that rand/srand must behave as if
no other library functions ever call them.  i.e. the state must
not change except when the application calls rand/srand.

Cheers,
-- 
Jacques Vidrine / n@nectar.com / jvidrine@verio.net / nectar@FreeBSD.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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