From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: random doesn't feel very random Date: Fri, 31 Aug 2012 11:06:45 -0400 Message-ID: References: <876288yh72.fsf@kanis.fr> <87wr0livd4.fsf@Rainer.invalid> <83k3wfqtyx.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1346425629 18475 80.91.229.3 (31 Aug 2012 15:07:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Aug 2012 15:07:09 +0000 (UTC) Cc: Stromeko@nexgo.de, rms@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 31 17:07:07 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T7SoL-0000RR-Sf for ged-emacs-devel@m.gmane.org; Fri, 31 Aug 2012 17:07:06 +0200 Original-Received: from localhost ([::1]:49637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7SoJ-0004mp-EQ for ged-emacs-devel@m.gmane.org; Fri, 31 Aug 2012 11:07:03 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7SoC-0004lc-EX for emacs-devel@gnu.org; Fri, 31 Aug 2012 11:07:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7So8-00085p-D0 for emacs-devel@gnu.org; Fri, 31 Aug 2012 11:06:56 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:45112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7So3-00085F-CD; Fri, 31 Aug 2012 11:06:47 -0400 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q7VF6jkl029118; Fri, 31 Aug 2012 11:06:45 -0400 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 918CFB40D4; Fri, 31 Aug 2012 11:06:45 -0400 (EDT) In-Reply-To: <83k3wfqtyx.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 31 Aug 2012 12:41:26 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4327=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4327> : streams <809347> : uri <1206826> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152914 Archived-At: >> > It is a feature that, if you don't call (random t), `random' returns >> > a predictable sequence. That is good for debugging. >> I wonder how often this has been useful. > ??? A pseudo-random sequence is always deterministic, that's what the > "pseudo" part is about. I'm sure you already know that. Yes, obviously I know that. So you've misunderstood what I said. I'm saying that I highly doubt that the fact that `random' always returns the exact same stream unless you explicitly call (random t) has been often useful (and used) for debugging in practice. >> many packages call (random t) at various times > Those packages have a bug that needs to be fixed. My point was that those bugs make the above "feature" more difficult to use, making it that much more doubtful that it has ever been useful. As for whether they're bugs or not: I tend to agree that they're bugs, but since currently our PRNG is not automatically seeded, those packages that need their `random' to vary (IOW basically every package that uses random) have no other choice but to call (random t) explicitly at various times. So to fix those bugs, we have to: - change Emacs's initialization so that it seeds its PRNG. - eliminate most/all calls to (random t), which is best done by changing `random' to do nothing when called with argument t (after all, re-seeding wouldn't make it less predictable anyway). Stefan