From owner-freebsd-current Sun Feb 2 13:23:43 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 AAF2B37B401 for ; Sun, 2 Feb 2003 13:23:41 -0800 (PST) Received: from 12-234-22-23.client.attbi.com (12-234-22-23.client.attbi.com [12.234.22.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id 246D043F9B for ; Sun, 2 Feb 2003 13:23:41 -0800 (PST) (envelope-from DougB@FreeBSD.org) Received: from slave.gorean.org (5zngsercth7t71sz@slave.gorean.org [10.0.0.1]) by 12-234-22-23.client.attbi.com (8.12.6/8.12.6) with ESMTP id h12LNcfS083081; Sun, 2 Feb 2003 13:23:38 -0800 (PST) (envelope-from DougB@FreeBSD.org) Date: Sun, 2 Feb 2003 13:23:38 -0800 (PST) From: Doug Barton To: Bakul Shah Cc: current@FreeBSD.org Subject: Re: rand() is broken In-Reply-To: <200302022006.PAA25355@valiant.cnchost.com> Message-ID: <20030202131437.V79739@12-234-22-23.pyvrag.nggov.pbz> References: <200302022006.PAA25355@valiant.cnchost.com> Organization: http://www.FreeBSD.org/ X-message-flag: Outlook -- Not just for spreading viruses anymore! MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 On Sun, 2 Feb 2003, Bakul Shah wrote: > Yes, *I* can do it but I don't work at every place they do > simulation! Well the code is still going to be available in cvs. It's not like we're going to magically make it disappear. :) > If in the extreme you are suggesting that a > portable application shouldn't rely on any OS features, you > are of course right but that kind of makes mockery of any > claims of compatibility. The point of compatibility is to > not break interfaces unless there is a significant benefit. I can think of one significant benefit... I had noticed that my perl script to pick random windowmaker themes (which uses rand()) seemed to be picking the same themes over and over again. Now I know why. :) I had to create a "last seen" list to artificially increase the "randomness." Oh wait, TWO benefits... xscreensaver is having the same problem. Seriously though, I think the (vast?) majority of our userbase expects random (or even pseudo-random) numbers to be, well, random. For a sufficiently naive definition of random anyway. While I can certainly sympathize with your needs here, with all due respect I think it's an edge case, and one that could be handled with a little customization on your part. Even if you didn't want a code solution, you could spool off BIGNUM "random" numbers from whatever source you choose and save them to disk so that you could get 100% repeatability. Your needs have more than one solution, but I don't think that depending on rand[om]() not to be random is a good one. Doug -- If it's moving, encrypt it. If it's not moving, encrypt it till it moves, then encrypt it some more. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message