From owner-freebsd-current Tue Feb 4 6:36: 8 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 CE99037B401 for ; Tue, 4 Feb 2003 06:36:06 -0800 (PST) Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB04943FA7 for ; Tue, 4 Feb 2003 06:36:05 -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 h14Ea4d6093555; Tue, 4 Feb 2003 17:36:04 +0300 (MSK) (envelope-from ache@pobrecita.freebsd.ru) Received: (from ache@localhost) by pobrecita.freebsd.ru (8.12.6/8.12.6/Submit) id h14Ea4xN093554; Tue, 4 Feb 2003 17:36:04 +0300 (MSK) (envelope-from ache) Date: Tue, 4 Feb 2003 17:36:04 +0300 From: "Andrey A. Chernov" To: Dag-Erling Smorgrav Cc: David Schultz , Kris Kennaway , current@FreeBSD.ORG Subject: Re: rand() is broken Message-ID: <20030204143604.GA93522@nagual.pp.ru> References: <20030204054020.GA2447@HAL9000.homeunix.com> <20030204094659.GA87303@nagual.pp.ru> <20030204115237.GA6483@HAL9000.homeunix.com> <20030204131006.GB92301@nagual.pp.ru> <20030204131748.GA92510@nagual.pp.ru> <20030204132845.GA92674@nagual.pp.ru> <20030204134714.GA92940@nagual.pp.ru> <20030204140806.GA93236@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue, Feb 04, 2003 at 15:22:03 +0100, Dag-Erling Smorgrav wrote: > > Yes we do. We get a better sequence for any given seed, i.e. we get > less correlation between n and x(n) for any given x(0). I don't think > it changes much for long sequences, but we get a better distribution > for short sequences (including short subsequences of long sequences). Maybe, I am not sure here, we need to ask expert. > As for patterns in the lower bits, we should try with a != 0 and see > how that affects the results. I believe the purpose of a in the LCG > algorithm is to scramble the lower bits. a != 0 eliminates 0 stuck problem, no additional visible effects. Even with a != 0 values are monotonically increased, I try with a == 123459876 0: 123459876 1: 185549787 2: 247639698 3: 309729609 4: 371819520 5: 433909431 6: 495999342 7: 558089253 8: 620179164 9: 682269075 -- 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