From owner-freebsd-current Sun Feb 2 10:48:30 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 564D437B401; Sun, 2 Feb 2003 10:48:29 -0800 (PST) Received: from agamemnon.cnchost.com (agamemnon.cnchost.com [207.155.252.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 472BF43F43; Sun, 2 Feb 2003 10:48:25 -0800 (PST) (envelope-from bakul@bitblocks.com) Received: from bitblocks.com (adsl-209-204-185-216.sonic.net [209.204.185.216]) by agamemnon.cnchost.com id NAA19508; Sun, 2 Feb 2003 13:48:01 -0500 (EST) [ConcentricHost SMTP Relay 1.15] Message-ID: <200302021848.NAA19508@agamemnon.cnchost.com> To: Mark Murray 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 15:32:32 GMT." <200302021532.h12FWWaX047973@grimreaper.grondar.org> Date: Sun, 02 Feb 2003 10:48:00 -0800 From: Bakul Shah 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 > 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. 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. *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. If you think random() is not random enough for your purposes, go create a new function with a *new* name. [I see from his latest email that PHK remembered the old discussion!] -- bakul To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message