Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2003 17:36:04 +0300
From:      "Andrey A. Chernov" <ache@nagual.pp.ru>
To:        Dag-Erling Smorgrav <des@ofug.org>
Cc:        David Schultz <dschultz@uclink.Berkeley.EDU>, Kris Kennaway <kris@obsecurity.org>, current@FreeBSD.ORG
Subject:   Re: rand() is broken
Message-ID:  <20030204143604.GA93522@nagual.pp.ru>
In-Reply-To: <xzpisw0unw4.fsf@flood.ping.uio.no>
References:  <20030204054020.GA2447@HAL9000.homeunix.com> <20030204094659.GA87303@nagual.pp.ru> <20030204115237.GA6483@HAL9000.homeunix.com> <xzpfzr4b3pw.fsf@flood.ping.uio.no> <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> <xzpisw0unw4.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030204143604.GA93522>