Date: Sun, 02 Feb 2003 10:31:39 +0100 From: phk@freebsd.org To: "Andrey A. Chernov" <ache@nagual.pp.ru> Cc: Kris Kennaway <kris@obsecurity.org>, current@freebsd.org Subject: Re: rand() is broken Message-ID: <33364.1044178299@critter.freebsd.dk> In-Reply-To: Your message of "Sun, 02 Feb 2003 12:27:18 %2B0300." <20030202092718.GA60116@nagual.pp.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <20030202092718.GA60116@nagual.pp.ru>, "Andrey A. Chernov" writes: > >--SUOF0GtieIMvvwua >Content-Type: text/plain; charset=us-ascii >Content-Disposition: inline >Content-Transfer-Encoding: quoted-printable > >On Sun, Feb 02, 2003 at 01:11:06 -0800, Kris Kennaway wrote: >>=20 >> Another problem (noticed by tjr) is that once the sequence hits '0' it >> jumps to INT_MAX and stays there forever. For example, seeding with >> srand(0) produces nothing but INT_MAX from rand(). >>=20 >> It looks like a lot more validation of this PRNG is needed. > >Don't have an idea about this thing yet, maybe some sign or variable size= >=20 >change fix required. > >BTW, note that new formulae also used in the kernel (by BSD developers) >and taken from there - libkern/random.c - so all you say is true there >too. It should be nuked from the kernel, and arc4random() used instead. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. 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?33364.1044178299>