From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Achim Gratz Newsgroups: gmane.emacs.devel Subject: Re: random doesn't feel very random Date: Sun, 26 Aug 2012 16:24:55 +0200 Organization: Linux Private Site Message-ID: <87wr0livd4.fsf@Rainer.invalid> References: <876288yh72.fsf@kanis.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1345991132 15792 80.91.229.3 (26 Aug 2012 14:25:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Aug 2012 14:25:32 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 26 16:25:31 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 1T5dmH-0005Zf-7I for ged-emacs-devel@m.gmane.org; Sun, 26 Aug 2012 16:25:25 +0200 Original-Received: from localhost ([::1]:59103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5dmF-0001RD-AO for ged-emacs-devel@m.gmane.org; Sun, 26 Aug 2012 10:25:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5dmD-0001R8-Eo for emacs-devel@gnu.org; Sun, 26 Aug 2012 10:25:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T5dm7-0003sj-G2 for emacs-devel@gnu.org; Sun, 26 Aug 2012 10:25:21 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:56889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5dm7-0003qJ-8Z for emacs-devel@gnu.org; Sun, 26 Aug 2012 10:25:15 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1T5dm4-0005Vy-Uo for emacs-devel@gnu.org; Sun, 26 Aug 2012 16:25:12 +0200 Original-Received: from pd9eb3a83.dip.t-dialin.net ([217.235.58.131]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Aug 2012 16:25:12 +0200 Original-Received: from Stromeko by pd9eb3a83.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Aug 2012 16:25:12 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: pd9eb3a83.dip.t-dialin.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:99b2M7gzWzF/DTtd1aeVoTDn4sA= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:152848 Archived-At: Richard Stallman writes: > If that is really true, maybe the code to set the seed needs to be > changed. Maybe it only gives you seed values from a subset of all > those possible. > > Perhaps instead of initializing the seed based on the time, it should > change the seed based on the time. That way, all possible seeds > could occur after (random t). Re-seeding a PRNG inside the same application is misguided even when there are multiple consumers of the sequence. Provided the PRNG is of sufficient quality, partial sequences aren't any less random. Therefore the PRNG should be seeded once at start-up, from a good source of entropy. The only application for re-seeding is to provide a repeatable sequence (but Emacs' random doesn't allow for that since you can't give the seed value directly) or if the PRNG state has been compromised. Given the widespread use of (random t) it should probably be made a no-op and a separate API to provide a local state for application that wish to control it for whatever reason should be made available. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Waldorf MIDI Implementation & additional documentation: http://Synth.Stromeko.net/Downloads.html#WaldorfDocs