Doing the iPod Shuffle We call in Weekend Edition's Math Guy, Keith Devlin, to help NPR's Susan Stamberg answer a listener's question about how the shuffle feature works — or doesn't — in iPods.

# Doing the iPod Shuffle

#### Doing the iPod Shuffle

• `<iframe src="https://www.npr.org/player/embed/89408926/89408877" width="100%" height="290" frameborder="0" scrolling="no" title="NPR embedded audio player">`
• Transcript

We call in Weekend Edition's Math Guy, Keith Devlin, to help NPR's Susan Stamberg answer a listener's question about how the shuffle feature works — or doesn't — in iPods.

SUSAN STAMBERG, host:

Lisa Forrest(ph), a listener from Bethesda, Maryland, has a math question perhaps as vexing as the ultimate value of Pi or the solution to Fermat's last theorem: what, she asks, are the mathematics behind the random feature of iPods. It's also known as the shuffle mode. The idea being that your iPod would pick out songs at random and play them for you. Mrs. Forrest wonders why the same songs keep coming up, while so many others never get played.

So, who else would we turn to for iPod algorithms, but our own math guy, Keith Devlin. Hi Keith.

Mr. KEITH DEVLIN (Executive Director, Center for the Study of Language and Information at Stanford): Hi Susan, nice to talk to you again.

STAMBERG: I agree, nice to talk to you. So, tell us, why is this - is the shuffle meant to be random or does it just sit there and shuffle?

Mr. DEVLIN: It is indeed meant to be random and before we get on to the math part of this, I think I should mention that if you go into iTunes and look at the various settings for iTunes, you will find that it's possible to set the degree to which the random shuffle operates. You can set it to shuffle without repetitions or you can set it to shuffle where it plays your favorite songs more frequently.

So you actually have quite a choice of the degree of randomization. So Lisa's problem may be that she's using a setting which deliberately selects certain songs over and over again.

But then there's the mathematical part and this is, of course, the part that you really got me on to talk about. People have an enormous difficulty recognizing randomness because one of the features of a genuinely random selection is you get lots of repetitions. What people usually think of as random is what we call uni-distributed. But in fact, randomness is full of patterns.

For example, if you start tossing a coin, you're going to get heads and tails and heads and tails. If you tossed it maybe 20 times, you're very likely to get three heads in a row or three tails. You're going to get streaks. An even more dramatic one was in the news about a week ago, some mathematicians simulated all of the Major League Baseball games that have ever been played, assuming the outcome of every pitch was random, and do you know that if every pitch had been random, you would get all of the records and streaks that baseball has ever seen, including Joe DiMaggio's famed 56-game hitting streak.

STAMBERG: No.

Mr. DEVLIN: In other words, all of the records in baseball could equally well have arisen by pure random behavior. So a Joe DiMaggio might just have been the guy who was lucky enough to get that 56 streak which was going to come up sooner or later, because randomness produces patterns and streaks that usually surprise us.

STAMBERG: Well, who would have thought of that?

Mr. DEVLIN: So, assuming that Apple have designed a really good randomizer in the iPod, then you are going to start getting repeats of songs and you are going to find that some songs don't come up seemingly for a long time. That's the way random behavior is.

STAMBERG: Keith, by the way, do you ever use random or shuffle on your iPod?

Mr. DEVLIN: Actually, I very rarely use random. I tend to like - I'm a mathematician and like to know what's coming next, so I run my through sequentially. I start with my favorite song and I go through them to the least favorite. I've got hundreds of them ordered by favorites within different play lists.

STAMBERG: And what's - what are you listening to right now?

Mr. DEVLIN: Well, right now I'm listening to you, Susan…

STAMBERG: Oh, good.

Mr. DEVLIN: But on my iPod…

STAMBERG: You're lucky I don't sing.

Mr. DEVLIN: Yeah, I'm too old to multitask to that extent, I'm afraid, but right now I've got a song by a group from Austin, Texas, called Wideawake that's called "Maybe Tonight, Maybe Tomorrow."

STAMBERG: So that's your favorite, and what's your least favorite? What's at the bottom of your list?

Mr. DEVLIN: Well, it's on my list, so I like it, but right at the bottom of my list is "Danny Boy" sung by Three Irish Tenors who people don't forget.

STAMBERG: I totally approve of that choice.

Mr. DEVLIN: That just reminds me of my ancestors hundreds of years ago from Ireland. I wasn't born in Ireland, but I think I have Irish ancestry.

STAMBERG: I would put it right down there with Klezmer music in my own iPod if I owned one. It's time for us to shuffle off. Thank you very much, Keith Devlin, executive director for the Center for the Study of Language and Information at Stanford.

Mr. DEVLIN: Okay. Thanks, Susan, and good luck to you.

(Soundbite of music)