Fisher-Yates shuffle for music streaming is perfectly random—too much so for some


The headline “When random is too random” caught my eye when the April issue of Significance, published by The Royal Statistical Society, circulated by me the other day.  It really makes no statistical sense, but the music-streaming service Spotify abandoned the truly random Fisher-Yates shuffle.  The problem with randomization is that it naturally produces repeats in tracks two or even three days in a row and occasionally back-to-back.  Although this happened purely by chance, Spotify consumers complained.

Along similar lines, I have been aggravated by screen savers that randomly show family photos.  It really seems that some get repeated too often even though it’s only by chance.  For a detailing of how Spotify’s software engineer Lukáš Poláček tweaked the Fisher-Yates shuffle to stretch songs out more evenly see this blog post.

“I think Fisher-Yates shuffle is one of the most beautiful random algorithms and it’s amazing that such a complicated problem can be solved in 3 lines of code in some programming languages.  And this is accomplished using the optimal number of operations and optimal amount of randomness.”

– Lukáš Poláček (who nevertheless, due to fickleness of music listeners, tweaked the algorithm to introduce a degree of unrandomization so it would reduce natural clustering)

  1. No comments yet.

You must be logged in to post a comment.

%d bloggers like this: