From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Kanis Newsgroups: gmane.emacs.devel Subject: Re: random doesn't feel very random, random doesn't feel very random, Re: random doesn't feel very random Date: Fri, 24 Aug 2012 19:19:39 +0200 Message-ID: <87d32g9pmq.fsf@googlemail.com> References: <876288yh72.fsf@kanis.fr> <876288yh72.fsf@kanis.fr> <876288yh72.fsf@kanis.fr> <87ipc8vkj6.fsf@uwakimon.sk.tsukuba.ac.jp> <87mx1kdd2i.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1345828798 473 80.91.229.3 (24 Aug 2012 17:19:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Aug 2012 17:19:58 +0000 (UTC) To: emacs devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 24 19:19:57 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 1T4xY2-0002H4-Kz for ged-emacs-devel@m.gmane.org; Fri, 24 Aug 2012 19:19:54 +0200 Original-Received: from localhost ([::1]:52612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4xY0-0003ss-UP for ged-emacs-devel@m.gmane.org; Fri, 24 Aug 2012 13:19:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4xXx-0003sZ-BK for emacs-devel@gnu.org; Fri, 24 Aug 2012 13:19:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4xXw-0000vR-1l for emacs-devel@gnu.org; Fri, 24 Aug 2012 13:19:49 -0400 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:35863) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4xXv-0000vK-QD for emacs-devel@gnu.org; Fri, 24 Aug 2012 13:19:47 -0400 Original-Received: by weys10 with SMTP id s10so1275700wey.0 for ; Fri, 24 Aug 2012 10:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:subject:message-id:references:face:x-hashcash:date :in-reply-to:user-agent:mime-version:content-type; bh=eQAFBYeZMaFARIip6+l1vK9SiZbimH3AkFoLAVM3KJ0=; b=Kn7N7grsYi0g0pCWI1w3Q/GAiFAGr3IOyRPn+sbe9SsY4XH2GqY0n3NkRM0EfqVEH7 08Sfoivwp6o8DhfYcvtmIps0V5oypM8ADB86G4qcXq8Md+xUpoYC4z670BKiEhrD7hwg YpYfQpy/UqDhaBrQz63g1QQ4k3oaLQKEZDrolum3SXs4AvP7hSNKb48nwq3Ba4pA3SzT 9SEDE/pXQXDKbO41SpmAVwX+dsjwA2OA3iL4AraGbg4KoIejTNwNwnz+h9s3P7nADBRk w/RmIOw5g3w3SH1avdDfkvy+pNg1CYKGyssGpR/5KqPnC8kRF2vejbQJZZS6EQgSNHp+ tgCw== Original-Received: by 10.180.81.193 with SMTP id c1mr7042755wiy.12.1345828785510; Fri, 24 Aug 2012 10:19:45 -0700 (PDT) Original-Received: from tao ([89.83.137.164]) by mx.google.com with ESMTPS id o2sm945215wiz.11.2012.08.24.10.19.41 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Aug 2012 10:19:43 -0700 (PDT) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAAB5QTFRF IBkXUxMTOCwoTC4qcUY8iFxQmmper31txpaJ/v/8aKZ1oAAAAcVJREFUOMt100tu2zAQAFDCXnUZ oAcIqG68LZULVLQBbwuSiffm6AIRRyeotAySJoVu2+FPpJWWC3/4NKOZocSW/yxWfnJ2+Bdwzhj7 8gleWVy7DXC2rkMNr2V/zRbghXIwthf3VbIA9Ffc71vZCSFyCEsBggtNS8ludwvfmhYA0Vn9o4DP zMWxR7+cPWzAYFzwM0ModtdmcDbDS6i/hT7L+RZof5yCXGrYe5jn2YO6BYMjgY+51tCIAqHgBLwR pwLnGuRjAKyBJkuN4yd4U92uCY1vUr2D/c5b8DuxyQwfOHUeaLqDJhnkkuGXbB56h2C1IVBdgncc bBi6feroa9B6jUDojnQPQKupbyXyeeCE1oT7Oqrt+SnfY3mkiyGA/3AmD3H5g32CcBx6hY8pRkwJ 9PpcjRGobUfprFnhAa1vepwcgMOhwG+pdSgKHFU9HAvoAH6XUl7lDUCCq5Qb6GMbVm3Aj++qDYCt wdBc/YHgOFCmS3mjDMRcSE2qY4E3Q3PVIQRQmeodNH4QEbRUFZzW+VotzwX4yTcRTySOML1qjcE5 hTirVqDHkMAP0PjAywp3d18JZtqzvr9zDYD+GaSKtE6Zlr/DLPNFmOcvBAAAAABJRU5ErkJggg== X-Hashcash: 1:20:120824:emacs-devel@gnu.org::wL4IlCVr4OLUuGri:0000000000000000000000000000000000000000006StR In-Reply-To: <87mx1kdd2i.fsf@thinkpad.tsdh.de> (Tassilo Horn's message of "Fri, 24 Aug 2012 08:22:13 +0200, Fri, 24 Aug 2012 16:03:41 +0900, Fri, 24 Aug 2012 02:10:28 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.169 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:152812 Archived-At: Tassilo Horn wrote: > You can test it at least. Some methods are discussed here. > > http://www.johndcook.com/Beautiful_Testing_ch10.pdf Thanks I'll look if I find the time and the inclination. "Stephen J. Turnbull" wrote: > To avoid this behavior, use `(random t)' I do. > I hope your life doesn't depend on the secrecy of your playlist, > though. :-) Nope ;) > If it always plays tracks from the same subset of your collection, but > in different orders, you may have made a programming error. It sort of does that. Here's the function that picks music up. I have attached the rest of the code if you'd like to see more. (defun ivan-emms-pick-album (dir length with-cache) "Return a LENGTH albums in a directory DIR. If WITH-CACHE is non-nil exclude albums that are in cache." (let* ((index 0) (ret (make-vector length nil)) (album (ivan-emms-list-subdir (concat ivan-emms-dir dir))) (album-length (length album)) ring) (when with-cache (setq ring (ivan-emms-last-load))) (while (< index length) (aset ret index (nth (if with-cache (let* ((r (random album-length)) (album (nth r album))) (while (ring-member ring r) (setq r (random album-length) album (nth r album))) (ring-insert ring album) r) (random album-length)) album)) (setq index (1+ index))) (when with-cache (ivan-emms-last-save ring)) ret)) > If you want to prove it without knowing the algorithm, that's a lot > more difficult. The basic techniques are in D. Knuth's The Art of > Computer Programming, Vol. 2: Seminumerical Algorithms. The state of > the art has advanced since then, but if you can detect non-randomness > with your flesh-and-blood ears, Knuth's tests will be enough. It's noted. -- Ivan Kanis http://ivan.kanis.fr A facility for quotation covers the absence of original thought. -- Lord Peter Wimsey I am listening to "Serge Gainsbourg - Initials B.B.".