Live data from Hacker News

Bring true randomness to Spotify with Fisher-Yates shuffle

github.com

11–12 of 12 posts

Re: Bring true randomness to Spotify with Fisher-Yates shuffle

#11
post #8
post #3

I can't seem to find the blog post, but you generally don't want true randomness because you don't want artists to cluster. You also almost never hear two songs by the same artist play consecutively on the radio.

That's the question. And the answer is that different people prefer different things. I for example vastly prefer to listen to a full releases, that would be "shuffle by album", others want it to be as non-repetitive as possible while staying in a genre, yet others would want to stay in a certain time period of music, but shuffle between genres occasionally, etc. Shuffling music on a per song basis is an interesting…

> And the answer is that different people prefer different things.

Exactly. There is no winning here.

When I was in college, I built a system for the college radio station that plays music while there are no DJs on the air. What I enjoyed most is keeping track of what songs played when (which we needed to do anyway for FCC compliance) so that we never play the same song twice until every song was played. This "felt" more random even though it wasn't.

Some people didn't like it. They wanted to hear a smaller subset of songs more often (the equivalent of putting a playlist on random). We solved that by letting users request songs through the website.

I wonder if there's a way to solve this by adding a setting called "repetitiveness". It's a value between 1 and 100. 1 is the least repetitive "play all songs once before repeating any" and 100 is "play the same sequence of songs every time."

Re: Bring true randomness to Spotify with Fisher-Yates shuffle

#12
post #3

I can't seem to find the blog post, but you generally don't want true randomness because you don't want artists to cluster. You also almost never hear two songs by the same artist play consecutively on the radio.

Ironically, I'm pretty sure you're thinking of this article by a Spotify engineer that has since been taken down: https://web.archive.org/web/20230410041435/https://engineeri... EDIT: > We noticed some users complaining about our shuffling algorithm playing a few songs from the same artist right after each other. ... > Since the Spotify service launched, we used Fisher-Yates shuffle to generate a perfectly random shu…

> this article

That's the one! Thank you!

Post reply on HN