From owner-freebsd-current Sun Feb 2 11:12:19 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 5F45837B401; Sun, 2 Feb 2003 11:12:17 -0800 (PST) Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.157.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1EE5243F75; Sun, 2 Feb 2003 11:12:16 -0800 (PST) (envelope-from mark@grondar.org) Received: from storm.FreeBSD.org.uk (Ugrondar@localhost [127.0.0.1]) by storm.FreeBSD.org.uk (8.12.6/8.12.6) with ESMTP id h12JBxLf079041; Sun, 2 Feb 2003 19:11:59 GMT (envelope-from mark@grondar.org) Received: (from Ugrondar@localhost) by storm.FreeBSD.org.uk (8.12.6/8.12.6/Submit) with UUCP id h12JBwJ6079040; Sun, 2 Feb 2003 19:11:59 GMT X-Authentication-Warning: storm.FreeBSD.org.uk: Ugrondar set sender to mark@grondar.org using -f Received: from grondar.org (localhost [127.0.0.1]) by grimreaper.grondar.org (8.12.6/8.12.6) with ESMTP id h12J8laX050048; Sun, 2 Feb 2003 21:08:47 +0200 (SAST) (envelope-from mark@grondar.org) From: Mark Murray Message-Id: <200302021908.h12J8laX050048@grimreaper.grondar.org> To: Bakul Shah Cc: "Jeroen C. van Gelderen" , phk@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: rand() is broken In-Reply-To: Your message of "Sun, 02 Feb 2003 10:48:00 PST." <200302021848.NAA19508@agamemnon.cnchost.com> Date: Sun, 02 Feb 2003 19:08:47 +0000 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 Bakul Shah writes: > > Good point. We can re-implement random() internally with arc4rand(). > > > > Objections? > > Guys, please realize that random() is also used in generating > simulation inputs (or timing or whatever). If you go change > the underlying algorithm or its parameters one can't generate > the same sequence from the same seed when repeating a test. > Some chip bug symptoms show up after hours/days of simulation > time and only with specific inputs so repeatablity is a > requirement. RC4 is _utterly_ repeatable, given a particular seed/key. > The old 16 bit rand() was broken enough that it didn't matter > much (read: _I_ don't care) if its behavior got changed but > random() has a pretty long cycle and enough "randomness" to > be very useful and it *is* used. Yes. And it breaks, and we have a complainant. > *Please* don't change random() -- if you do that you will > break existing tests. It is not a matter of just rewriting > tests since there is no easy way to predict which input > triggers a certain bug -- one can try to use the same > binaries but that prevents fixing of bugs in the test > generation code itself. Heisenbug. Which tests do we break? Tests for specific output, or tests for more general cases? The random() function in libc is documented to give the same pseudo-random output for a particular seed. if you link your program against a _different_ libc, you cannot expect your results to follow a particular number sequence. We have to be able to fix bugs, and a bug has been identified. If you want a stable generator here, link statically, and keep a set of compatiblity libraries around. > If you think random() is not random enough for your purposes, > go create a new function with a *new* name. Any supporters of this request? > [I see from his latest email that PHK remembered the old > discussion!] So did I! M -- Mark Murray iumop ap!sdn w,I idlaH To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message