From owner-freebsd-current Sun Feb 2 12:55: 2 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 4B61437B401 for ; Sun, 2 Feb 2003 12:55:01 -0800 (PST) Received: from tonnant.cnchost.com (tonnant.concentric.net [207.155.248.72]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDA7343F85 for ; Sun, 2 Feb 2003 12:55:00 -0800 (PST) (envelope-from bakul@bitblocks.com) Received: from bitblocks.com (adsl-209-204-185-216.sonic.net [209.204.185.216]) by tonnant.cnchost.com id PAA23917; Sun, 2 Feb 2003 15:54:58 -0500 (EST) [ConcentricHost SMTP Relay 1.15] Message-ID: <200302022054.PAA23917@tonnant.cnchost.com> To: Mark Murray Cc: current@FreeBSD.ORG Subject: Re: rand() is broken In-reply-to: Your message of "Sun, 02 Feb 2003 20:15:05 GMT." <200302022015.h12KF5aX050851@grimreaper.grondar.org> Date: Sun, 02 Feb 2003 12:54:58 -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 > Would you prefer that we defined random() as > > int > random(void) > { > static int retval = 0; > > return retval++; > } No because that would be a change from the exisiting random() behavior :-) As I indicated in my earlier email random() is not broken, srand() is (as corrected by Andrey Chernov) so you won't be fixing any bugs by changing random(). If you guys had left the original rand() alone we wouldn't be discussing any of this.... random(3) also provides an initstate() call which presumably allows you to change the amount of randomnes. So here is another suggestion: why not fold your algorithm change in that function? For example, initstate(seed, "RC4", 3); changes the algorithm to RC4. Yes, this is a change in the interface but one I am sure most people can live with. > > There is an expectation that on subsequent releases of the > > same OS things continue to work. > > Where is that expectation guaranteed? > Where is that expectation supported? This expectation is a reasonable one. Most commerical OSes do a good job of maintaining compatibility. IRIX certainly did a pretty good job of it. FreeBSD also does a pretty good job on the whole. > The two are related topics. Yes, but not the same. > Consider the (joking reference to) "elephant-free biology". :-) The way things are going we will be there pretty soon :-( To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message