From owner-freebsd-current Sun Feb 2 17: 1: 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 8236137B405 for ; Sun, 2 Feb 2003 17:00:58 -0800 (PST) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3A5A443F3F for ; Sun, 2 Feb 2003 17:00:57 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from pool0402.cvx21-bradley.dialup.earthlink.net ([209.179.193.147] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 18fUyk-0003QR-00; Sun, 02 Feb 2003 17:00:55 -0800 Message-ID: <3E3DBEEF.BE487BD6@mindspring.com> Date: Sun, 02 Feb 2003 16:59:27 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Don Cc: current@FreeBSD.ORG Subject: Re: rand() is broken References: <200302021848.NAA19508@agamemnon.cnchost.com> <200302030007.01718.ejb@lythe.org.uk> <20030202190827.K2458@calis.blacksun.org> <200302030026.33781.ejb@lythe.org.uk> <20030202193215.E2519@calis.blacksun.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4144d44f298c0a9fcfc6fdf85ef4fa283a2d4e88014a4647c350badd9bab72f9c350badd9bab72f9c 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 Don wrote: > > > It isn't a question of the API. It's a question of expected function > > > output. > > > > Then it's applicable not only to binary packages as Terry states, but any > > source that uses rand(). > > I think Terry mentioned binary packages simply because it is harder to fix > them than something available as source but I could be mistaken. I mentioned them because they are impossible to fix without hacking the system libc.so, whereas with source, you can recompile the code and override the libc version with your own. LD_PRELOAD could be used, if the interface is unchanged, and the saved state area is not managed promiscuously anywhere. The main problem is new code that depends on new behaviour conflicting with old code that depends on old behaviour. A number of the ASIC packages Bakul *may* be using come precompiled from the vendor, without source code (and yes, they have FreeBSD versions available, when you are slinging that kind of money around). > > I would say that depending on the internal algorithm used by rand() (or > > random()) is a bad idea; however, I don't know what the relevant standards > > say about this, so I won't say any further. > > > > (Why is it a bad idea? Because I'm not going to write software which makes > > this assumption; I'm sure that even if at some point in time all systems use > > an identical algorithm, at some point my software will have to run on a > > system which uses something different. So if I really need it, I will take > > rand() from libc and place it in my own code.) > > If only all developers were as good as you we would not have a problem. Heh. If they were, this would not be an issue in the first place, because they would not be using the system random number generators from libc, and so they would see no reason to fix them. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message