Date: Sun, 2 Feb 2003 16:42:25 +0300 From: "Andrey A. Chernov" <ache@nagual.pp.ru> To: Tim Robbins <tjr@FreeBSD.org> Cc: Kris Kennaway <kris@obsecurity.org>, current@FreeBSD.org Subject: Re: rand() is broken Message-ID: <20030202134225.GA63673@nagual.pp.ru> In-Reply-To: <20030203001735.A30440@dilbert.robbins.dropbear.id.au> References: <20030202070644.GA9987@rot13.obsecurity.org> <20030202090422.GA59750@nagual.pp.ru> <20030202091106.GA72723@rot13.obsecurity.org> <20030202102621.GA60900@nagual.pp.ru> <20030202123035.GB62977@nagual.pp.ru> <20030203001735.A30440@dilbert.robbins.dropbear.id.au>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Feb 03, 2003 at 00:17:35 +1100, Tim Robbins wrote: > > I believe that this change just moves the "bad" seed to 123459876; after > calling srand() with that seed, each call to rand() returns 0. Yes. Nothing better is possible for this formulae and this is documented in algorithm, some value must be excluded. Excluding 0 is bad only because srand(0) is commonly used and srand(123459876) is not. Ragarding to old formulae, the question is: what is worse, generate non-random lover bits everytime (old variant) or exclude one seed value (new variant)? Of course formulae can be changed to some another algorithm, but keep in mind that rand() must be simple and speedy. Now used variant is most simpler, others are much more complex. -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030202134225.GA63673>