From: Ivan Kanis <ivan.kanis@googlemail.com>
To: emacs devel <emacs-devel@gnu.org>
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 [thread overview]
Message-ID: <87d32g9pmq.fsf@googlemail.com> (raw)
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")
Tassilo Horn <tsdh@gnu.org> 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" <stephen@xemacs.org> 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.".
next prev parent reply other threads:[~2012-08-24 17:19 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-24 5:47 random doesn't feel very random Ivan Kanis
2012-08-24 6:22 ` Tassilo Horn
2012-08-24 17:19 ` Ivan Kanis [this message]
2012-08-24 18:50 ` random doesn't feel very random, random doesn't feel very random, " Stephen J. Turnbull
2012-08-25 7:46 ` Ivan Kanis
2012-08-24 6:30 ` Leo
2012-08-24 22:48 ` Richard Stallman
2012-08-24 22:57 ` Andreas Schwab
2012-08-25 20:55 ` Richard Stallman
2012-08-25 23:25 ` Leo
2012-08-26 13:12 ` Richard Stallman
2012-08-26 14:24 ` Achim Gratz
2012-08-26 23:22 ` Leo
2012-08-27 0:50 ` Stefan Monnier
2012-08-27 6:31 ` Simon Leinen
2012-08-27 3:41 ` Richard Stallman
2012-08-27 4:48 ` Stefan Monnier
2012-08-31 9:41 ` Eli Zaretskii
2012-08-31 15:06 ` Stefan Monnier
2012-08-31 15:23 ` chad
2012-08-31 17:50 ` Eli Zaretskii
2012-08-31 19:43 ` Stefan Monnier
2012-09-01 1:18 ` Paul Eggert
2012-09-01 7:19 ` Achim Gratz
2012-09-01 13:19 ` Paul Eggert
2012-09-04 19:19 ` Nix
2012-09-04 20:07 ` Paul Eggert
2012-09-04 20:11 ` Nix
2012-09-02 12:27 ` Jason Rumney
2012-09-02 13:08 ` Stefan Monnier
2012-09-01 7:22 ` Ivan Kanis
2012-09-01 11:13 ` joakim
2012-08-31 23:04 ` Leo
2012-08-27 5:17 ` Achim Gratz
2012-08-31 9:42 ` Eli Zaretskii
2012-08-31 15:07 ` Stefan Monnier
2012-08-31 17:50 ` Eli Zaretskii
2012-08-26 9:06 ` Ivan Kanis
2012-08-24 7:03 ` Stephen J. Turnbull
2012-08-24 9:10 ` Paul Eggert
2012-08-24 17:45 ` Stephen J. Turnbull
2012-08-24 12:45 ` OT: appropriateness of "random" for playlist generation (was: random doesn't feel very random) Jeremiah Dodds
2012-08-24 14:37 ` random doesn't feel very random Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d32g9pmq.fsf@googlemail.com \
--to=ivan.kanis@googlemail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.