clementine-player / Clementine

:tangerine: Clementine Music Player
https://www.clementine-player.org/
GNU General Public License v3.0
3.76k stars 677 forks source link

Random songs are not very random #4352

Closed aiphee closed 10 years ago

aiphee commented 10 years ago

I’m using Clementine on Linux and when i select shulle all, it is very unrandom, same songs and artists are playing very often.

As i understand Clementine is using some integrated library which is fine on Windows where random genarator sucks, but it should use /dev/random on Linux.

To compare, random in Rhytmbox is much better.

TheUbuntuGuy commented 10 years ago

I have noticed this as well. It currently uses the simple C++ std::default_random_engine as the generator. I propose it be changed to something like the mersenne twister (std::mt19937) which would work on all platforms. I'd rather do that than have platform-specific generators. It's a tiny edit and I'll probably try it some time this weekend.

hatstand commented 10 years ago

I think you actually want it to be less random, like deliberately avoiding playing a randomly selected song if it's too close to the last one. I think iTunes does something like this.

TheUbuntuGuy commented 10 years ago

That's actually quite a good point. I'll think about a possible implementation. While on the topic of randomness, I was also looking into the dynamic mode track selection. It currently grabs the whole DB and orders by random() which is very slow on large libraries like mine, and again, not terribly random. But that's a separate issue. It does at least exclude previously played tracks. It might be beneficial to do something like that with the shuffle in which it excludes the same artist and/or album for a number of cycles.

a1batross commented 10 years ago

+1. Make random more randomness.

aiphee commented 10 years ago

"I think you actually want it to be less random" No, i think that random is just broken, cuz some artists never get to play.

Some random generators just suck: http://boallen.com/random-numbers.html

It would be good to make some test and see the numbers.

davidsansome commented 10 years ago

Can you check if that really is the case? Start at the top of a (short) playlist and keep hitting "Next", write down which tracks are played. If repeat is off, eventually pressing "Next" will stop instead of going to a different song, and at that point each track in the playlist should've been played exactly once. If repeat is on it should go back to the first track that was played and repeat them in the same order as before.

If that doesn't happen then please tell me exactly what does.

TheUbuntuGuy commented 10 years ago

I did as you asked with both the default generator and the mersenne twister. The results on a playlist of length 53 are shown. It appears fine, however there is bit more "clumping" in the default algorithm. I would need to automate this to test something like a whole library to get better statistics, which is where the problem seems to be occurring.

screenshot from 2014-05-19 124358