Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Feb 2003 22:30:50 -0800
From:      Eric Hodel <drbrain@segment7.net>
To:        David Schultz <dschultz@uclink.Berkeley.EDU>
Cc:        freebsd-current@freebsd.org
Subject:   Re: rand() is broken
Message-ID:  <20030204063049.GU46498@segment7.net>
In-Reply-To: <20030204054020.GA2447@HAL9000.homeunix.com>
References:  <20030202070644.GA9987@rot13.obsecurity.org> <20030202090422.GA59750@nagual.pp.ru> <20030203002639.GB44914@HAL9000.homeunix.com> <20030203100002.GA73386@nagual.pp.ru> <20030204054020.GA2447@HAL9000.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--yIMHf/Pa6CzSkARF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

David Schultz (dschultz@uclink.Berkeley.EDU) wrote:

> Rather than me showing you more semi-meaningful numbers from
> Marsaglia's tests, why don't you look at the following sequence,
> which I get by taking the lowest four bits of the 201st number in
> the rand() sequence for seeds of (0, 1, 2, ...).
>=20

f c 9 6 2 f c 8 5 2 e b 8 4 1 e b 7 4 1 d a 7 3 0 d 9 6 3
f c 9 6 2 f c 8 5 2 e b 8 4 1 e b 7 4 1 d a 7 3 0 d 9 6 3
f c 9 6 2 f c 8 5 2 e b 8 4 1 e a 7 4 1 d a 7 3 0 d 9 6 3
f c 9 6 2 f c 8 5 2 e b 8 4 1 e a 7 4 1 d a 7 3 0 d 9 6 3
f c 9 5 2 f c 8 5 2 e b 8 4 1 e a 7 4 1 d a 7 3 0 d 9 6 3
f c 9 5 2 f c 8 5 2 e b 8 4 1 e a 7 4 0 d a 7 3 0 d 9 6 3
f c 9 5 2 f c 8 5 2 e b 8 4 1 e a 7 4 0 d a 7 3 0 d 9 6 3
f c 9 5 2 f b 8 5 2 e b 8 4 1 e a 7 4 0 d a 7 3 0 d 9 6 3
f c 9 5 2 f b 8 5 2 e b 8 4 1 e a 7 4 0 d a 7 3 0 d 9 6 3
f c 9 5 2 f b 8 5 2 e b 8 4 1 e a 7 4 0 d a 6 3 0 d 9 6 3
f c 9 5 2 f b 8 5 2 e b 8 4 1 e a 7 4 0 d a 6 3 0 d 9 6 3
f=20

> Notice that 'f c 9' repeats in regular intervals and is always
> followed by a 5 or 6.  There is a similar pattern for 'e a 7'.  I
> think this pretty much demonstrates that the algorithm isn't good
> enough to generate high-quality randomness with respect to
> different seed values.  I'm not suggesting that it absolutely must
> be replaced, since most rand() implementations aren't very good in
> the first place, but I'm pointing out that to do a good job of
> fixing it once and for all is harder than you might think.

A littele modification shows just how similar these sequences are :)

--=20
Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04


--yIMHf/Pa6CzSkARF
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (FreeBSD)

iD8DBQE+P14ZMypVHHlsnwQRAqMPAKCl+/RGVU9+Yh1hyQ+JrJ0jUfZRkwCg2NtW
vYkdEOBzJBd5Uy6TXretqoA=
=JtWN
-----END PGP SIGNATURE-----

--yIMHf/Pa6CzSkARF--

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?20030204063049.GU46498>