Ask HN: Why are modern music players so bad at playing music in random order?

127 points by winternett ↗ HN
On my phone I have a micro SD card with thousands of Mp3s on it yet I catch both Google Play Music and VLC player playing the same progression of music over and over when I have the random button set to on... I thought this was because it was a tactic to get me to upgrade the music players I was using, but it also happens lately on all kinds of devices I use.

YouTube, Spotify, and SoundCloud provide revolutionary services yet it seems like a lot of the time I am listening to pre-arranged and designated music playlists rather than a truly honest music stream.

In the days of the 5 disk CD changer, people truly knew what random meant. no tune was played twice until all of the tunes were played...

151 comments

[ 2.9 ms ] story [ 113 ms ] thread
Am just here to nitpick, but the 5 disk CD changer behavior that you just described is not true randomness (by definition).
It is in fact a random shuffling. Hence the name that was used for this function.
Nitpicking your nitpick, the difference is whether the random sampling is with replacement or without replacement. Wikipedia's definition of "simple random sample" defines it to include both ways:

[S]ampling is typically done "without replacement", i.e., one deliberately avoids choosing any member of the population more than once. Although simple random sampling can be conducted with replacement instead, this is less common and would normally be described more fully as simple random sampling with replacement.

Ref: https://en.wikipedia.org/wiki/Simple_random_sample

nitnitnitpick: GP is likely (and overly pedantically) referring to the use of a PRNG to implement the shuffle, rather than using a true random source.
It is randomness if you are "playing N tracks in random order" and not "select the next track randomly from N choices in a loop".
Which is why it was called "shuffle" and not "random".

Shuffle (mostly) used to do what you expected when you had a medium like CD with a small number of tracks.

As the number of available tracks grew, the definition became less and less obvious.

With a service like Spotify, you could design an entire multi-page specification to cover all the different possible "shuffle" options you could give users - all of which would be useful in at least some settings.

Instead of which users get one button and some guessing.

Dunno about contemporary music players, but:

> no tune was played twice until all of the tunes were played

That is definitely not compatible with actual mathematical “randomness”. Try rolling a die multiple times and see whether you get all six numbers before repeats. It’s very unlikely (probability of all six rolls being unique = 6!/6^6 = 1.5%)

Which brings up the interesting question — what do humans actually expect from “shuffle” mode?

I don't think mathematics is the issue here, rather problem definition.

OP wants "Shuffle my playlist into a random order and then play it through"

You are thinking closer to "After this song is done, choose a new song at random among ALL available."

Spotify's is a mixture, while good offline clients tend to go to the first.

Personally what i want out of shuffle is that once a song has been replayed more than n amount of times, it gets temporily removed from the queue for that session or an amount of time.
In statistics classes we learned that all problems can be reduced to problems with balls and urns. In this problems you can put the ball back in the urn or not put it back, both are valid things and can model different problems.
Think of every single erroneous belief that people have about randomness. A pleasing music-randomizer algorithm obeys all of these.

The term found on a lot of music players is not "random", it is "shuffle", and this is an important distinction. The term comes from cards. Take a deck of cards, shuffle it, and turn each card over in order from top to bottom. You expect that every card in the deck will be seen once and only once; turning up, say, two eights of clubs in a row means that something is dreadfully wrong with your deck.

Humans tend to expect a similar behavior from "shuffle" modes: the same song does not repeat for a while. If people are shuffling by song, then they may also expect that performers don't repeat within a (smaller) timeframe.

Nobody expects "pick a random number between 1 and numsongs, play that song, repeat, and be perfectly happy to play Baby Shark forty-seven times in a row if that number keeps on coming up".

Mathematical randomness can describe an enormous range of behaviour, including shuffling. Shuffling is sampling without replacement. Rolling a die repeatedly is sampling with replacement (imagine the numbers 1-6 written on cards and mixed together in a bag; to get a die's behaviour you need to put a card you draw out and look at back again before the next draw).
> That is definitely not compatible with actual mathematical “randomness”.

Of course it is, the concept of randomness is much broader than you allow for. The specific issue you refer to here is if you are sampling with or without replacement - both are valid.

There is another issue which is the distribution you use. Should songs be equally likely to occur, or should the ones you've played more occur more likely?

You may also extend sampling strategies to genre, or to exclude repeated artists, or whatever - but all of these things could still be done via random sampling.

I got so tired with YouTube's recommendation for playing Hindi songs, because it got so repetitive, that I opted to delete my entire viewing history. This did not help and with-in a few weeks, the 'random' playlist became predictably repetitive again. I'm having similar experience with YouTube Music as well.
Because random is actually "random based on what you've listened to most in your playlist, because we believe that we know the definition of random more than you do"
Seems like a Markov Chain approach--considered over artist and genre--would be a good idea.
> no tune was played twice until all of the tunes were played...

That doesn't sound random.

I use Google Play Music and it "randomizes" things in the way you desire. It takes your playlist and shuffles the entries; you can even press a button to see how it's sorted it. That ordering sticks around forever if you take no further action, though, so it will repeat that random ordering indefinitely unless you press the shuffle button to disable that, then start playing something, then press the shuffle button again.

If its programmed like youtube, it only shuffles the last 100 you have visited in your list, not the whole list.
Not sure exactly what you're referring to here, but on Google Play Music, there's a concept of a "queue" of music that's currently playing/has been played. Generally it's just the songs in order of the album/playlist/etc. where you selected the song to play, but you can also manually add/delete/reorder the songs on the list. Since it keeps track of the songs that were played previously in the queue (to enable the "previous track" button, among other things), enabling shuffle just reorders the queue in a random way (with the currently playing song first). From the few times when I've used it with extremely large lists of songs (e.g. my entire music library), it doesn't just shuffle a subset of the queue that you have currently active, but the entire thing. You can also choose to start playing an album/playlist/etc. shuffled, which just puts the entire thing in the queue in a random order and starts playing through it.
I first noticed this with Spotify's "Shuffle" - it was so infuriating, particularly when I'd skip a song, it would just play another song from the same artist... sometimes even the same album! That's from a playlist with hundreds of artists and songs...
I noticed the same; and it seems to be getting worse...
I've always assumed the royalty cost and popularity factored in, but I've never tried to dig to deep into it.

When I shuffle a playlist on Amazon Music, it wont repeat until the end of the playlist.

Here's the problem: go ahead and ask a bunch of different people what they want/expect their shuffle/random button to do and you'll get a bunch of different answers.

1. I want it to play in a truly random fashion, with replacement (same song twice in a row is possible).

2. I want it to play in a truly random fashion, without replacement (each song is removed from the list once played).

3. I want it to "seem" random (don't play too many songs by the same artist in a row).

4. I want it to be random, but predictable (same "random" ordering if I start the playlist again).

5. I want it to play my favourite songs more often than my lower-rated songs.

6. I want it to play my less-commonly played songs more often than the stuff I listen to all the time.

So: what exactly do you want when you say random?

Or what about this:

I am indecisive about what music I want to listen to in this current moment and I want you to give me options that I will deny until I become decisive about what I want.

This is basically what want too, so I like Quod Libet's "Random Album" (and Random Artist and Random Genre) command. It simply focuses on a new album each time I press Ctrl+M, which I can play or queue up.
This was my favorite feature in winamp and itunes. It doesn't seem to exist in many music apps. I couldn't find an android app that does it, and spotify doesn't do it on any system. On desktop, It's possible to script spotify behavior, so with some work I was able to define a global keyboard shortcut to choose a random album and play it. Not perfect, but gets the job done.
I would say what people usually want is "I want my playlist shuffled in a way that feels like variety". But, I don't have any data to back that up ;)
Most music player developers assume our music collections are small I guess, and they're trying to encourage cloud storage rather than local saved files as well possibly, because it generates money by encouraging music sales, storage upgrades, and monthly subscriptions.
(comment deleted)
Good point...

I mainly dont want to hear a playlist that starts with the same tune every time and then progresses through the same order of tunes when I select Random.

So often, in Google Play Music selecting random will play any of of 10 pre-set playlist cues.... The tunes will be a mix of one big polaylist that just starts at various points on the master playlist. This is why I often run across the same tunes, and why they follow each other in the exact same order.

e.g.

Normal Play Cue: A-B-C-D-E-F-G

Random is selected -

Random play attenpt 1. B-A-C-D-F-G-E (Several tunes present on the micro SD card never play)

Random play attenpt 2. F-G-E-B-A-C-D (Several tunes present on the micro SD card never play)

Random play attenpt 3. B-F-G-E-A-G-E (Several tunes present on the micro SD card never play)

I prefer the "Shuffle" feature I guess if you want to look at the semantic side of this discussion, where not tune is played twice or in the same order whenever the random button is pressed, and every time I press random, the player should recall the last tune, and pick a new playable tune each time the skip button is pressed or after the prior tune comes to an end.

#2 seems like it should be the default but I feel I normally get #4.
Also, "I want 'random' songs that are musically appealing to hear in sequence." A sort of lite DJ logic, really; not necessarily modifying the songs' entrances and exits, but more selecting keys and tempos.
From what I remember, Pandora did that really well. It's been a while since I've used it, but their classification system was really cool.
Yes, this is still true, and it's great. Within the songs and artists that typically play on my Pandora stations, it will play similar songs in clusters, with the exception that it won't play the exact same artist twice in close succession. This makes the playlist a lot better (in my opinion).

The only quirk I've noticed is when the same person has multiple bands... I've had it play Jack White or Les Claypool 4 times in a row, for example.

That's funny, I don't like how Pandora works on the custom stations I've tried to build. It feels too much like it is going through the set of seed artists in some repeating order, playing a batch of similar items to one seed before switching to the next batch.

I'd much rather have these sub-genres woven together with changing styles at each track boundary, as a sort of counterpoint.

If I can remember all the way back to when I used to make my own "mix tapes" transferred from vinyl records, I think I used to do this sort of interleaving. So, I think my preference existed before I ever experienced the shuffle of a 5 or 10 disc Sony CD changers, which usually changed discs on every track change and avoided any repeats until the entire set was done.

Because of my preference for shuffle, I used to burn a CD or two for use in rental cars, where I added a pseudo-random prefix to the file names. This gave me a shuffled play when the in-dash player was set to just play sequentially, so I didn't have to discover a random mode with repeats in one particular car...

I switched from Pandora to Spotify a couple months back because my daughter wanted Spotify and they have a family plan, and I didn't want to pay for both services. I really, really miss Pandora, to the point I may pay for it separately (and I don't listen all that often), specifically because I love how their radio station type format works. If they had their "play this exact song I want" offering working before Spotify entrenched itself, I can't imagine why anyone would choose Spotify over it.

I'll probably spend a bit more time trying to get Spotify to work as I want, but in general it's resulted in me just listening to less music. I guess that's good for Spotify, since they're still getting paid (but not if it makes be question why I'm still paying them).

I was very sad when Pandora left the NZ market. :(
It must be the same algorithm they use to propose new tracks, eg when we play “similar artists”.

“What is the best to listen after this track?” - just with a super small subset of tracks.

Um, no? I would argue most people would say they want 1 or 2, and the rest of those are mostly things that developers convince themselves are adequate substitutes for these things.
We made a music system for the office I worked at a few years back; all of these options came up as possible meanings of "random". We ended up with a system where people could vote on which random they wanted, and all of them got used over the course of a few months. 3 and 4 were very popular.

It also sparked a lively debate about whether people actually wanted what they said they wanted or were just being difficult.

People are weird and English is imprecise.

Don't forget that the sufflers will often try to match song outros and intros so they seamlessly cross-fade.

This could have the appearance of #4.

Can you name shufflers which actually do this?
Smart playlists in iTunes were great for solving 5 and 6 with separate auto-updated playlists, but sadly Spotify has no interest in this problem.

I hate the trend from product managers of responding to "wow there's a lot of things people might be intending here" with "let's just pick one in the name of simplicity." Give me the hooks to let me make my own solutions for the other possibilities!

What I want is to have the options laid out before be so I can pick which one I want. Spotify and friends seem to go with a "fuck you, we know what you want better than you do" approach, which is one of many reasons I prefer to own my music instead of streaming it.
I want #2 but most players do not do this. Both Amazon Music and Google Play fail although Amazon does a better job at giving me #2. Sometimes it will give me a different random order but sometimes it gives me the same order as it did last time I asked it to shuffle the playlist. To get it to resent the random shuffle I have to manually close down Amazon Music and restart it. Then it resets the shuffle.
> 3. I want it to "seem" random (don't play too many songs by the same artist in a row).

That can still be random, for as long as we're not defining the variable:

    from $artists choose artist randomly
    from $artist.repertoire choose song randomly
    play $song
and then of course with the #2 variation on both variables.
You will get very weird results from that depending on your song library. If you have every song from a prolific artist, and one to two songl you like from a few other artists, you'll get a nice random distribution among artists, but not among your library. For very lopsided libraries, such as people that just started a service and maybe have added one or two full artist catalogues and a smattering of other songs they like that they thought of (which I imagine isn't all that uncommon, it's the state I commonly find myself in on a new service), it will result in a lot of repeats and ignoring a bunch of your library.
80% of people mean this: I don't want to hear the same song too soon after hearing it before. How soon is "too soon"? Probably anywhere from 50 to 200 songs.

Easiest solution that gets you 99% there would be to make a shuffled list, run through the whole thing, then shuffle again. The only reason why this wasn't done in the past was lack of RAM, which isn't an issue anymore.

Or if RAM really actually is an issue on your embedded device, use a Debruijn sequence.

Do you have a source for that claim?

For me, random means: "I want to hear every song in this selection exactly once, chosen randomly". Random should mean uniformly distributed and I don't care whether the same artist or album is played back-to-back. I feel like this is exactly what "shuffle" has meant for decades before some UX quack at Spotify headquarters decided they knew better.

So... what you're saying is that you don't want to hear the same song too soon after hearing it before?
No, I’m saying I want to hear every song in the list exactly once before any is repeated. Your summary is more generous than my definition.
So... You'd say that my summary gets you 80% of the way there?
That's shuffle, not random. Maybe randomized. With random, every song should have the same chance of being picked, which would technically allow the same song to play twice. If you'd let the player run for a decade, every song should have played about the same number of times.

But this usually leads to people perceiving the feature as not being random enough.

See Spotify for example: https://www.quora.com/Is-Spotifys-shuffle-feature-truly-rand...

Random has a lot of meanings, and you are picking a very specific one. It doesn't have to be uniformly distributed, for example, but relevant here is I don't think there's a problem describing a random shuffle as "random". It is playing a list in a random order.
(comment deleted)
Thats why the feature is usually called "shuffle" rather than "random". Then if you stop to think about it a bit, the expected meaning is reasonably clear.
Lack of RAM? Make an array of pointers or ints or whatever corresponding to the current order of songs, then lookup each new song as the current song ends. Maybe 1kB RAM...
Yes, lack of RAM. First mp3 player I ever worked on consisted of a PIC driving an IDE hard drive over I/O pins, and an mp3 chip over I2C, with 2k RAM for the whole shebang. If you want to support more than 256 songs, you'll need 2 bytes per index value, so 2k RAM just for the shuffle table if you have 1000 songs. Then there's the hard drive controller, the FS driver and file I/O interface, the LCD driver, the send buffer to the mp3 chip, etc, etc.
Mp3 players have had more than 2k of RAM for way longer than two decades.

The hardware restrictions of the earliest IDE HD based MP3 players really have nothing to do with any limitations on modern shuffle ability.

IPod in 2001 had 32MB of RAM. 2k RAM is not relevant to this discussion. You getting close to discussing 3 decade old technology.

It's very relevant. The early technological restrictions become the standard practice, which fail to change after the original restrictions no longer apply.

Using random number generators for shuffle mode was a stopgap measure that everyone else cargo culted because it's easier than critical thought.

> Yes, lack of RAM

So how about using a maximal linear feedback shift register of smallest size greater than the number of songs, skipping entries that are beyond the end of the list?

Either keep the polynomials[1] in a small list, or implement them as separate functions, invoking the one you need via a function pointer. Both approaches take just a wee bit of extra FLASH/ROM, and just a few bytes of RAM.

https://en.wikipedia.org/wiki/Linear-feedback_shift_register...

(comment deleted)
So a permutation? There's no need to store the whole shuffled array in RAM, a big 64-bit co-prime number is enough, you don't care about cryptographically secure numbers, so even 32 bits could work.

For example for a 1000 songs playlist, you choose n to be 2416648531, start with i = 0, you then get the following permutation: 0, 531, 62, 593, 124, 655, 186, 717, 248.

Excellent post. Reminds me of the old Warcraft 3 days when some players would be like, "I got Undead four times in a row, this isn't random Bli$$ard!!!1"
I would expect from a random playlist function to shuffle the playlist once randomly (or using a good PRNG with long period) whenever the function is called. Option 2 sounds closest to this, but there is no need to remove anything, the player always plays the next song in the list.

It's odd to hear that this is not standard, given that it's a standard algorithm. Maybe memory limitations?

There’s another dimension... the playback mechanism. I think that some of these solutions actually make some sort of hidden playlist to accommodate garbage Bluetooth integrations in cars.

I’ve definitely seen scenarios where I’ve heard the same random play order due to some fuckery with a car Bluetooth connection.

Further complicating things, lots of people will say they want 1 or 2, but really want one of the others, because they don’t really understand what randomness looks like.

Lots of music players started out with true randomness and then dialed it back because people complained that it wasn’t very random.

Because users never wanted mathematical randomness. They wanted variety.

Not that saying "random" is wrong, but users mostly mean it in a colloquial sense, while programmers are apt to interpret it in a technical sense. But one leads to math.urandom() and the other to shuffle algorithms.

Take that comment almost verbatim, and turn it into a menu in the options/config area, and you can have my money!
I love this idea so much, I made it an issue on a the Lofi repo -- a somewhat popular Spotify player I built: https://github.com/dvx/lofi/issues/37

I'll work on it when I can get a bit of free time.

That is a really cool app. I have been using Miniplay for this. Already installed it and uninstalled Miniplay.

Edit: Oh, and it is always on top, you are my favorite open source contributor.

Users want more control. Take this idea apply it to what shows up on your favorite social network feed/timeline.
the random function in itunes employs heuristics like this. specifically, it avoids multiple songs by same artist in a row.
I have no idea if this is possible, but it would be awesome to see Spotify implement some kind of learning algorithm that would run your playlists like a professional DJ would, lining them up in progression by tone, tempo, sound, etc. That would be amazing.
> 1. I want it to play in a truly random fashion, with replacement (same song twice in a row is possible).

Anyone outside of HN would interpret that as broken random. So we can throw it out.

> 2. I want it to play in a truly random fashion, without replacement (each song is removed from the list once played).

Nope, not good enough for non-specialist randomness.

> 3. I want it to "seem" random (don't play too many songs by the same artist in a row).

Bingo. It should definitely seem random. Because the string "seem random" equals "random" for someone who isn't a technical expert in randomness.

> 4. I want it to be random, but predictable (same "random" ordering if I start the playlist again).

Normies don't care about random seeds for pseudorandom number generators, so nope.

> 5. I want it to play my favourite songs more often than my lower-rated songs.

That's a bonus feature that can be implemented with a slider.

> 6. I want it to play my less-commonly played songs more often than the stuff I listen to all the time.

Same as above

> So: what exactly do you want when you say random?

One obvious definition for normy random, plus a slider with least and most favorited at the left and right, respectively.

Done.

Or if the UI allowed me to easily play music based on which folders tunes are in, it would solve most of my problems... I already have my mp3s organized by genre in folders, and updates are easier to manage that way, and then random play can match my mood better, instead of going from wu-tang to Celine Dion (I also keep wedding music in my collection just in case...)
(comment deleted)
In the 90s this would have been solved with a single radio button option in the settings menu.

We've come so far with UI design now that we can't have that.

They should probably just revive winamp. Winamp really kicked the llama's a$$, and knew what random meant... And also knew how to have a good UI.
Nice written! I have nothing to complain about Spotify. I also like to think they choose the next songs based on the sound of the last ones. Eg no heavy music after a yoga relaxing soundtrack.

Maybe it is not the way i’d order my playlist, but I trust Spotify knows their stuff. There must be a lot of engineering there.

Why not trusting the musical tastes of a robot, after all?

> I have nothing to complain about Spotify.

I do. 1 and 2 aren't even options. I have playlists with 100 or so songs in it. I don't hate that I can predict what the next song will be. Smart Shuffle is fine, so long as you don't say it's random and you offer an actual shuffle button that works the way shuffle has worked since the introduction of the CD player.

Exactly random, the first one. Everything else is not random. I guess you're answer provides a indirect answer. We devs like to think up algos, which the users do not want. So these algos get shoved beneath the "I feel lucky" button hoping that nobody notices that his her shuffle was replaced with something beta.

TL, dr: Bad product management, that didn't stop coders from featurecreeping

4 basically causes the problems though. Who wants that!
If it literally plays the same progression of music over and over, it's because the randomization is poorly designed. I had an early MP3 player that literally had the same "random" order, to the point where I always knew what song would come next.

In that case, it's because random numbers generated by a computer are pseudorandom, or just generated by the exact same arithmetic sequence. For instance, here's a really bad pseudo-random number generator: Start with 4. Take the last number, divide it by 2, and if it's even add 5. If it goes over 100, subtract 100. (I didn't claim it was good.)

These pseudo-random number generators can be improved by providing a seed number, which means if you give it the same starting point it will generate the exact same sequence, but the key is giving it a random seed. Often programs provide the current time as the seed. My last MP3 player would have been much better if they did that.

Spotify does a much better job with actually randomly shuffling playlists. But the problem with Spotify is if you listen to, say, Wilco radio, it's not adventurous enough and keeps playing the same few songs over and over in random order until you get sick of all of them.

Spotify upped its game with the "daily mix" feature, but yeah, radio stations are kind of crappy right now.

Hopefully someone will pop up with a logic listing of the way WinAmp did "shuffle". Surprisingly complicated. "Random" isn't enough, even with a good PRNG. Believe it or not radio DJ's had more job than just talking over your favorite bits of the song.
The answer is that people(like OP) who think they want random, really want shuffle. Or randomly choosing from whatever songs have NOT yet played.
Pandora (even though I gave it up for Spotify years ago) seemed to be the best at keeping variety. Spotify is very bad at it.
Never used pandora but MixRadio was the best for my taste. Spotify is nice but it’s really fucking hard to find new stuff that within Spotify itself.
A bit tangential, but for a while I've wanted the ability to "pin" certain songs together for the purpose of random shuffles so that they always get played back to back. One good example of this is the second half Abbey Road; if I'm shuffling some Beatles songs, I really want "Carry That Weight" to come immediately after "Golden Slumbers" (and if I'm being honest, I want "The End" coming right after both of those). I know that I could just manually concatenate the songs together with some sort of music editor and then put that as a single song in my library, but I've always wondered if there were any music players that supported this sort of thing built-in when shuffling music. Has anyone ever used a player that lets you do this, or am I just the only one who wants this?
I have noticed that Apple Music seems to always play “we are the champions” after “we will rock you” despite them being different tracks. Not sure how that works!
Those two songs were concatenated and released as a single.

Unless you specifically want to play the album versions, Apple is likely to give you the single.

I, too, want this -- I mostly listen to game soundtracks, and sometimes two tracks according to the OST (or the unofficial rip) really felt like one in the game, from when they played. Other times I really do just want to specifically play part two of whatever, though, so if I manually concatenated them I'd need to still keep the originals around; if I did that, I wouldn't be able to just play through the entire album linearly without a repeat. So yeah, being able to pin in a shuffle would be good.
Dark Side of the Moon, Abbey Road, and We Will Rock You / We Are the Champions are my go to examples for this. I hate going for a run and getting the penultimate track from Dark Side of the Moon on shuffle. It cuts out right at the climax, I always stop my run and manually tell Google to play Eclipse next.

While I'm on my soapbox, another tremendous annoyance I want to get rid of: "Deluxe" tracks. I'm so tired of scrolling through re-released/deluxe versions of albums to find the album with the original track listing. I don't want remixes or rough cuts in my random playlist. With all of the shallow marketing attempts at selling the same classic albums to the general public over and over again, the alternate tracks outnumber the original.

That's a great example! I also can't listen to Brain Damage without want to hear Eclipse after.
(comment deleted)
Actually, I almost implemented this a few times over the years in Quod Libet (https://github.com/quodlibet/quodlibet/issues/703), my use-case being mainly for classical pieces or DJ mixes... but never got round to it.

Eventually someone kindly wrote a plugin that did pretty much this using what we all agreed was the best way: the under-loved `grouping` tag. Caveat: I haven't actually tried it yet...

(Please file a Github issue if you try it but it doesn't work...)

I haven't used it much in a while, but doesn't iTunes have the option of grouping songs together in some way? Basically exactly what you're asking for?
Seems to me like a perfect opportunity for a simple neural network or machine learning model to predict the next song to play based on the last k songs having been trained on a bunch of existing playlists.
a NN is overkill for something like this. you don't even complex logic to make a good shuffled mix.
Spotify (and I assume others) doesn't exactly serve a random playlist, but one that favours/returns more revenue back to them. So older releases, "burned out" songs and so on. Create a playlist with 10 songs, add 8 before the 90s (e.g. Cure, U2 etc.) and add some newer ones (after 2000 - e.g. Radiohead). You'll be living in the 80s for most of the time...

If you search the Spotify forums, there are a few posts on the issue with no official answer from Spotify whatsoever.

One way to mitigate that is to play music in alphabetical order, it's more random than "random" and you can listen to artists you wouldn't ear with the "random" order
This doesn't work too well if someone adds Nine Inch Nails' Ghosts I-IV or Kendrick Lamar's untitled unmastered to their playlist.
I also suspect this is the case. I also feel like it's part of the reason Spotify has aggressively wiped out easy discovery of user-curated playlists in favor of their own playlists. Just about every playlist you see when browsing around is one authored by Spotify. It used to be that you could find lost of community-made content in the Browse tab. If you want a good, user-maintained playlist now, you have to know its exact name in order to find it. There is no community behind the platform anymore, only an algorithm that maximizes margin for the company.
Steve Jobs in 2005: "You know we've gotten a lot of people that say our shuffle's not random. Well it really is random but sometimes random means you've got two songs from the same artist next to each other. Just happens randomly sometimes.

And so what we've added is smart shuffle to actually make it less random - if you want.

Even though people will think it's more random it's actually less random and what it is, in preferences, there it is right there, it says smart shuffle allows you to control how likely you are to hear multiple songs by the same artist or from the same album in a row."

https://youtu.be/lg188Ebas9E?t=719

I always got the feeling that the original iPod Shuffle would randomize your songs ONCE, and that's why people where complaining. So when you loaded up your Shuffle, the software would order the songs randomly, on a playlist, for that set of songs. The Shuffle would then reshuffle the songs, when new one where added or removed, but only then.

That theory also explained the disconnect between the complaints and Apples response. Apple would indeed be right that the music was randomized, but not continuously, as consumers expected.

It was never clear to me what the issue actually was, perhaps we really don't understand randomness.

Apple's response above was talking about iTunes, not about iPods.
If I remember correctly, the encryption performed by the Enigma machine was cracked largely because they would never repeat the same character twice in a 3 letter key. The Allies discovered this and it was a big help in their code breaking efforts.

My point being, even mathematicians might mistakenly believe that repeating a song or artist is less random. The creators of the Enigma machine were not dumb, but they believed that repeating letters would be more predictable and thus less random.

I thought the weakness was that a character was never replaced by itself? Eg. HH (for Heil Hitler) could never be replaced with HH, no matter what the seed.
Your right, I think I was wrong. They made a few similar mistakes, but what I described might be wrong.

They did not allow a digit in the key to repeat in the same position 2 days in a row, I just reread. If the key was "123" yesterday, it could not be "145" today, because the first position was unchanged.

This is why Apple calls it "shuffle" rather than "random."
Funny, when I was looking for my first part time dev job in college, a company interviewed me on “how to create a random playlist”. Didn’t get the job.

To this day I still wasn’t sure what was the purpose of that question? Was it to see how I think or did they really wanted me to come up with a way to create random playlist that satisfies their arbitrary definition of random

I don't have a problem playing my local ogg/mp3 collection in shuffle mode with XMMS; but using Youtube for listening to music sucks in a related regard.

It seems like pretty much no matter what song I start listening to on YT, it eventually falls into a rut where I start hearing the same handful of songs that I've heard a million times. It's like it's too good at figuring out "what I like" and tries to only play songs it "knows" I like. Or more likely, since plenty of what I like are "deep cuts", it's just playing the most popular few songs by the given artist(s).

The order within a given session is probably shuffled up OK, but it still sucks from a variety standpoint because I don't want to hear "Eighteen and Life", "Round and Round", "Kickstart My Heart", "Livin' On A Prayer", "Rock You Like A Hurricane", "Fallen Angel", "Shot In The Dark", etc., day after day after day after day after day... as much as I like all of those songs.

It does seem to be at least somewhat genre aware though. If I start out listening to classical music, it doesn't jump to metal/rock, or if I start out listening to synthwave, it doesn't bridge to classical. But the problem I just described seems to exist within each genre. :-(

Google Play Music seems to truly understand shuffle. Everytime you press shuffle button, you can see the playlist change randomly. I think it is very straight forward, randomize without repetition, still many streaming apps fail to implement it - add Saavn, Gaana to the list too.
> no tune was played twice until all of the tunes were played...

So…not random, then?

Not related to the OP’s complaint, but a shocking few can shuffle by random album. Apple regressed: the iPod could but the iPhone can’t.
This is something my main music player had circa 2003 when I used a linux desktop player.

Since then I've not had it any service or software I use, it's the missing killer feature for me. I want "random"/recommended albums not recommended/random songs.

You can hack the functionality into desktop spotify, if you care enough (on linux and mac at least).