It’s a single function call to randomize the order of a list in most randomization libraries. The hardest part would be to persist this randomized list across program restarts, and it’s not hard either.
Unfortunately, not Plex. Plex has the absolute worst fucking shuffle mechanism I have ever used in my entire fucking life. It will literally play things in the exact same order multiple times in a row like days later. And in the Plexamp app, it will literally not play past like the fourth track on any album.
I don’t think any of the ones I used are truly random, or there’s something else going on. I often just randomize my whole music library and it’s always pretty samey. It’s often the same songs coming up even though I have 100s and I know for a fact there’s songs that have never come up.
Hmm, if the songs never show up, it might be worth checking, whether they can be played when you select them manually. I’ve had it before where the particular music player didn’t understand the file format or the metadata of a song, so it just silently skipped it.
But yeah, otherwise that’s weird. Obviously, some of the more corporate music players will try to do weird stuff with how shuffle works, but there’s so many open-source music players out there, where I just don’t see why they’d bother to implement something else than randomized order…
I bet it’s possible to make a function that given a song in a list it returns the next song (or previous) in such a way that it’s random but for a given song the previous/next one are always the same, depending on some parameter. That way the only two things the program has to remember is the current song and the parameter used to compute the next one. Then each time shuffle is enabled a new “seed” parameter is rolled.
I’m not sure how you would ensure that the songs only show up once in that list, unless you do weird shit like re-rolling the seed until you find one where this happens to be true.
But also, that’s a lot harder than just storing the shuffled list. 😅
You don’t have to do anything fancy, I don’t think. Initialise your RNG with the seed that you have stored, shuffle the list, and then rotate the list to get to the ‘first song’. Every RNG seed will give a correct result.
If you shuffle using eg. Durstenfeld/Knuth shuffle, which is O(n), then you can make a note of the ‘first song’s position’ and do the rotation at the end of shuffling straight to the first song, in a single pass.
You’ll still get a repeatable ordering if songs are added or removed from the playlist - the order will be different, of course - and it takes a lot less storage to write down the seed and the ID of the ‘first song’, which might matter if you’re using a crappy old music player with very limited storage space.
Pretty sure that’s how most of them work…?
It’s a single function call to randomize the order of a list in most randomization libraries. The hardest part would be to persist this randomized list across program restarts, and it’s not hard either.
Unfortunately, not Plex. Plex has the absolute worst fucking shuffle mechanism I have ever used in my entire fucking life. It will literally play things in the exact same order multiple times in a row like days later. And in the Plexamp app, it will literally not play past like the fourth track on any album.
I don’t think any of the ones I used are truly random, or there’s something else going on. I often just randomize my whole music library and it’s always pretty samey. It’s often the same songs coming up even though I have 100s and I know for a fact there’s songs that have never come up.
True randomness has a lot more “clumping” than seems intuitive.
Hmm, if the songs never show up, it might be worth checking, whether they can be played when you select them manually. I’ve had it before where the particular music player didn’t understand the file format or the metadata of a song, so it just silently skipped it.
But yeah, otherwise that’s weird. Obviously, some of the more corporate music players will try to do weird stuff with how shuffle works, but there’s so many open-source music players out there, where I just don’t see why they’d bother to implement something else than randomized order…
The songs do work. I recently switched to symfoniun. Haven’t had it long enough to test the randomness but I’m liking the other features so far.
I bet it’s possible to make a function that given a song in a list it returns the next song (or previous) in such a way that it’s random but for a given song the previous/next one are always the same, depending on some parameter. That way the only two things the program has to remember is the current song and the parameter used to compute the next one. Then each time shuffle is enabled a new “seed” parameter is rolled.
I’m not sure how you would ensure that the songs only show up once in that list, unless you do weird shit like re-rolling the seed until you find one where this happens to be true.
But also, that’s a lot harder than just storing the shuffled list. 😅
You don’t have to do anything fancy, I don’t think. Initialise your RNG with the seed that you have stored, shuffle the list, and then rotate the list to get to the ‘first song’. Every RNG seed will give a correct result.
If you shuffle using eg. Durstenfeld/Knuth shuffle, which is O(n), then you can make a note of the ‘first song’s position’ and do the rotation at the end of shuffling straight to the first song, in a single pass.
You’ll still get a repeatable ordering if songs are added or removed from the playlist - the order will be different, of course - and it takes a lot less storage to write down the seed and the ID of the ‘first song’, which might matter if you’re using a crappy old music player with very limited storage space.
Ah yeah, very good point. Their description didn’t have me thinking of this kind of solution, but yeah, that should work.