View Single Post
pycage's Avatar
Posts: 3,404 | Thanked: 4,474 times | Joined on Oct 2005 @ Germany
#408
Originally Posted by mase View Post
I have added a lot of albums to a playlist. When I start the playlist
with shuffle, I think, that titles are played only from a few albums.
Is that possible? What shuffle algorithm is used?
Random selection on a list of items where every item gets removed from when played, so it doesn't get played again until list got depleted completely at which point it gets filled up again.

Given time, the shuffling plays songs from all albums in the playlist.

The code for selecting the next item is this:
Code:
idx = random.randint(0, len(self.__random_files) - 1)
next_item = self.__random_files.pop(idx)
self.__random_files being the list of items not played yet.
It might well be that random.randint doesn't distribute equally.

Documentation: http://docs.python.org/library/random.html
__________________
Tidings - RSS and Podcast aggregator for Jolla - https://github.com/pycage/tidings
Cargo Dock - file/cloud manager for Jolla - https://github.com/pycage/cargodock