Date: Mon, 3 Feb 2003 14:18:59 +0300 From: "Andrey A. Chernov" <ache@nagual.pp.ru> To: Mark Murray <mark@grondar.org> Cc: Kris Kennaway <kris@obsecurity.org>, Tim Robbins <tjr@FreeBSD.ORG>, current@FreeBSD.ORG Subject: Re: Final fix for 0 problem (was Re: rand() is broken) Message-ID: <20030203111858.GA77286@nagual.pp.ru> In-Reply-To: <20030203110841.GA77187@nagual.pp.ru> References: <20030202222635.GA68806@nagual.pp.ru> <200302031055.h13AtgaX058602@grimreaper.grondar.org> <20030203110841.GA77187@nagual.pp.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Feb 03, 2003 at 14:08:41 +0300, Andrey A. Chernov wrote: > On Mon, Feb 03, 2003 at 10:55:42 +0000, Mark Murray wrote: > > > > How do you _know_ that your newly chosen magic number isn't going to cause > > some kind of recurring (and too-short) sequence of numbers? > > I run simple test for it, it is not too short. To be more specific - it never returns to 0 from this value at least in 2**31 iterations. You can test it by yourself, the code is obvious: srand(0) ... loop ... if (rand() == 0) print iteration number -- 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?20030203111858.GA77286>