Randomness and the iPod


Is the Shuffle feature in iTunes and the iPod really random? I don’t care, because I know how to make iTunes and the iPod do what I want to do. And now you can too.

There’s been a lot of talk recently about the ‘Shuffle” feature of the iPod. Many are reporting stories of repeated songs and amazing coincidences playing the only two songs of a given artist one right after the other. The conclusions drawn from all of these stories is that the iPod's Shuffle isn’t really random. But is this a reasonable conclusion?

As the author of a desktop picture “randomizer” (DPAutochanger), I have given the subject of randomness a good deal of thought. It seems to me that most people misunderstand it. What does “random” mean? A dictionary definition says “lacking any definite plan or order or purpose; governed by or depending on chance.” Nothing about non-repeating there. I’m not a mathematician, but as I study the literature, I see nothing that would indicate that repeating numbers wouldn't be considered a random sequence if there was no way to predict that outcome.

So when most people complain that a random number generator is “broken”, what do they really want? John Etherington, in his answer to a question in The New Scientist makes a good observation when he states “There is a popular misconception that ‘random’ means ‘thoroughly mixed’.” My point exactly. What people really want is an unpredictable sequence wherein all numbers are used before any is repeated. And this is not what you are going to get from a random number generator. In fact, I would say that the “better” a random number generator is, the less likely that you will get this behavior.

It turns out that if this is what you want, you have to be intentional about it. It doesn’t take a lot of code, but using rand() just isn’t going to do it. So, it appears that it‘s a bad rap to blame the iPod shuffle behavior on a bad random number generator. But does the iPod shuffle have code to prevent non-repeating? I don’t know; I don’t have access to the source, and I don’t have enough patience or time to run through my entire library on shuffle making notes. And I don’t care, because I know how to make iTunes and the iPod do what I want to do.

The key is Smart Playlists. If you haven’t used them, here is a little tutorial. First, go to the File menu in iTunes and select “New Smart Playlist...”:




A new dialog will pop up:




I have a lot of Christmas music in my collection that I’m not particularly interested in hearing the rest of the year, so I use the capabilities of the Smart Playlist to limit that. But I also use the “Limit” control to give me the results I want:




You can click the plus sign if you want to add a condition to your playlist.

Now, this goes a long way towards getting me what I (and I think most people) want. I’ve been using this method for over 6 months, and I’ve been generally happy with the results. But some time ago I noticed that some days were richer in music from a particular album, or a particular genre. I realized it was because when I first got the iPod, I played music from a particular genre, or music from whole albums. This meant that the least recently played music will tend to stick together, resulting in the clumping I was hearing. I decided I could write a program to mix up those results.

I must warn you that this program will change the “Last Played” information, so if this information is important to you, don’t use this program!

With that warning in mind, you can download iTunes Randomizer here. This is free software, though I retain the copyright. I make no warrant as to its usefulness or safety. This program is written for Mac OS X. (Sorry, I don’t know how to write it for Windows). Source code is available on request (random at quandir.com).

Before running iTunes Randomizer start iTunes. Select the Library, and sort by Album. When you run iTunes Randomizer, you will see something like this:




Your “effective days” will depend on the size of your library. If you play your iPod more or less than the 8 hours I have put in, you can type in a new value and press Return or Tab. The new effective days will be calculated.

When you click “Randomize”, all of the “Last Played” dates in your library will be changed. The program will try to give each song in an album a different last played date. Obviously, if an album has more songs than the effective days, it won’t be able to do that.

When it is done, your songs should be sufficiently mixed up for your Smart Playlist to give you what you need.

If this has been helpful to you, you might like my other programs. Head over to Quandir Solutions Homepage and check things out!

Posted: Sat - October 8, 2005 at 06:16 PM          


©