From owner-freebsd-current Sun Feb 2 13:12: 0 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 27CA737B401 for ; Sun, 2 Feb 2003 13:11:58 -0800 (PST) Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.157.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4161443F43 for ; Sun, 2 Feb 2003 13:11:57 -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 h12LBsLf080157; Sun, 2 Feb 2003 21:11:54 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 h12LBsXK080156; Sun, 2 Feb 2003 21:11:54 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 h12L6naX051530; Sun, 2 Feb 2003 23:06:49 +0200 (SAST) (envelope-from mark@grondar.org) From: Mark Murray Message-Id: <200302022106.h12L6naX051530@grimreaper.grondar.org> To: Bakul Shah Cc: current@FreeBSD.ORG Subject: Re: rand() is broken In-Reply-To: Your message of "Sun, 02 Feb 2003 12:54:58 PST." <200302022054.PAA23917@tonnant.cnchost.com> Date: Sun, 02 Feb 2003 21:06:49 +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: > 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. No. Evil interface change. #ifdef hell while programs try to figure out OS differences. If an os provides a function, that function should be as good as possible while not breaking standards. We have lousy functions like gets(3), that we have to keep because the standards say we do and programmers keep on writing code that uses them. rand() and random() have a docimented interface, and empirical programmer expectations about their outputs simply result in bad code. > > > 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. "Reasonable" is an opinion. It is not shared by me. :-) Irix was well known for its bugs. 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