From owner-freebsd-current Mon Feb 3 3:19: 3 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB0F937B401; Mon, 3 Feb 2003 03:19:02 -0800 (PST) Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA44B43F43; Mon, 3 Feb 2003 03:19:01 -0800 (PST) (envelope-from ache@pobrecita.freebsd.ru) Received: from pobrecita.freebsd.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.12.6/8.12.6) with ESMTP id h13BJ0d6077321; Mon, 3 Feb 2003 14:19:00 +0300 (MSK) (envelope-from ache@pobrecita.freebsd.ru) Received: (from ache@localhost) by pobrecita.freebsd.ru (8.12.6/8.12.6/Submit) id h13BJ0lr077320; Mon, 3 Feb 2003 14:19:00 +0300 (MSK) (envelope-from ache) Date: Mon, 3 Feb 2003 14:18:59 +0300 From: "Andrey A. Chernov" To: Mark Murray Cc: Kris Kennaway , Tim Robbins , current@FreeBSD.ORG Subject: Re: Final fix for 0 problem (was Re: rand() is broken) Message-ID: <20030203111858.GA77286@nagual.pp.ru> References: <20030202222635.GA68806@nagual.pp.ru> <200302031055.h13AtgaX058602@grimreaper.grondar.org> <20030203110841.GA77187@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030203110841.GA77187@nagual.pp.ru> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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