[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: random doesn't feel very random, random doesn't feel very random, Re
From: |
Ivan Kanis |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) |
Tassilo Horn <address@hidden> 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" <address@hidden> 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.".
- random doesn't feel very random, Ivan Kanis, 2012/08/24
- Re: random doesn't feel very random, Tassilo Horn, 2012/08/24
- Re: random doesn't feel very random, random doesn't feel very random, Re: random doesn't feel very random,
Ivan Kanis <=
- Re: random doesn't feel very random, Leo, 2012/08/24
- Re: random doesn't feel very random, Richard Stallman, 2012/08/24
- Re: random doesn't feel very random, Andreas Schwab, 2012/08/24
- Re: random doesn't feel very random, Richard Stallman, 2012/08/25
- Re: random doesn't feel very random, Leo, 2012/08/25
- Re: random doesn't feel very random, Richard Stallman, 2012/08/26
- Re: random doesn't feel very random, Achim Gratz, 2012/08/26
- Re: random doesn't feel very random, Leo, 2012/08/26