From owner-freebsd-current Sun Feb 16 21:16:48 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 4E1CF37B405 for ; Sun, 16 Feb 2003 21:16:43 -0800 (PST) Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id BAB3D43F75 for ; Sun, 16 Feb 2003 21:16:41 -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.7/8.12.7) with ESMTP id h1H5GdEJ027830; Mon, 17 Feb 2003 08:16:39 +0300 (MSK) (envelope-from ache@pobrecita.freebsd.ru) Received: (from ache@localhost) by pobrecita.freebsd.ru (8.12.7/8.12.6/Submit) id h1H5GdDH027829; Mon, 17 Feb 2003 08:16:39 +0300 (MSK) (envelope-from ache) Date: Mon, 17 Feb 2003 08:16:39 +0300 From: "Andrey A. Chernov" To: Kris Kennaway Cc: current@FreeBSD.org Subject: Re: cvs commit: src/lib/libc/stdlib rand.c Message-ID: <20030217051639.GA27710@nagual.pp.ru> References: <200302170352.h1H3qawJ062671@repoman.freebsd.org> <20030217045729.GA68471@rot13.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="qMm9M+Fa2AknHoGS" Content-Disposition: inline In-Reply-To: <20030217045729.GA68471@rot13.obsecurity.org> 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 --qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 16, 2003 at 20:57:29 -0800, Kris Kennaway wrote: > On Sun, Feb 16, 2003 at 07:52:35PM -0800, Andrey A. Chernov wrote: >=20 > > So, monotonically increased seed->first value correlation problem rem= ains... >=20 > I think we should commit this patch (to -current) and fix all the > problems that pop up. For example, it's used in awk (which started > this set of changes), and in some of the XFree86 libraries. I agree. (diff is for old rand.c, but idea is clear in anycase). I have no fancy ideas how to fix correlation problem AND keep rand_r() compatibility at the same time. All linear mod-type generators share this problem with monotonic seeding and usual solution is shuffling array (more complex code than I use), but it will be incompatible with rand_r() again. If we back out most of changes and return to very first formulae with=20 overflow, we 1) Make monotonic increasing for seed->first_value less visible. 2) Not fix seed->first_value correlation (taking some parts of bits will show repeated pattern). 3) Make distribution and lower bits bad. --=20 Andrey A. Chernov http://ache.pp.ru/ --qMm9M+Fa2AknHoGS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (FreeBSD) iQCVAwUBPlBwN+JgpPLZnQjrAQGwBQQApVvTqRAxzggEO1hs1Pdq7d/1680Kl8QQ Wza3gJi6rJv8Duorh0kKBRC4Vi7amL4HMhf85clNBMPTfFTrF1k8hZ4p77Lt/J8T tY9LfRmhEYFfCQPAINbEWxVw33si6FcsaSF+Zdqyt6hZiItmDSKUrAM+nLnAXovy IOB2pdybtD0= =KcEp -----END PGP SIGNATURE----- --qMm9M+Fa2AknHoGS-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message