Wednesday, April 30, 2008

Duplicate songs on iTunes

Cav just stuck up a post where he was trying to figure out the chances of playing the same song twice in a session when you have a library of 1641 songs. I thought I'd have a shot at solving it, although my probability math isn't perfect either :-P. His question was particularly aimed at iTunes, but for our purposes we're going to assume that song selection is purely random (iTunes biases things somewhat in reality).

Obviously, for a 1 song session, the chances of playing the same song twice are zero. In a two song session, they are 1 in 1641, and in a 1,642 song session, the chances hit 100%. A 1,641 song session has an extremely small chance of playing each song exactly once. Those are some good reality checks on the probability. But how do you work it out for other session lengths?

Well, let's say I want to figure out the probability for a session of length n. We'll assume I know the probability for a session of length n-1, which we'll call p, and which is some value between 0 (no chance at all) and 1 (100% chance). I picture it something like this:


0....................0.5.....................1
ppppppppxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

This is kind of a random-o-meter. 'p' is the probability that we've already had a duplicate, and 'x' is what's left over. So, here's how I think of it: We're throwing a random dart at the meter. If it hits 'p', we had a duplicate even before we hit the current song. If we hit an x, we MIGHT still have a duplicate, because the current song might be the duplicate. What are the chances of that?

Well, we know that we've already played n-1 songs, and none of them were duplicates (or our dart would have landed on p). There are 1,641 songs to choose from, and there's an (n-1)/1641 chance that this time, we will pick a duplicate. So, if we land in the x region, then (n-1) in 1641 times, we still get a duplicate. So the probability is:

p: The chance that we have already played a duplicate
PLUS
The chance of hitting the x region (1-p) TIMES the chance of playing a duplicate (n-1)/1641

We already know the values for n=1 and n=2, but now we have some rules for figuring out additional values:

1: 0
2: 0.06%
3: 0.18%
4: 0.36%
5: 0.61%
10: 2.7%
20: 10.97%
30: 23.41%
50: 52.96%
100: 95.4%
200: 99.99997%

I hope that was enlightening.

Wednesday, April 16, 2008

Something really unusual in Hollywood

The National Association of Broadcasters is a nationwide group that acts as a kind of networking umbrella for everybody who works in broadcasting. They cover television, radio, and similar technologies. They lobby for the interests of broadcasters before congress, and they put on a huge national convention every year.

Last year, the convention was in Las Vegas, and was attended by about 111,000 people. The keynote address was unusually controversial. It was given by Tim Robbins, who works in a variety of media (acting, writing, directing, music, etc.).

Although there was a no-recording clause for the speech, and although everyone had to turn off their video cameras, someone caught a brief audio clip of the most controversial segment. In short, he railed on the media for the low moral character of their shows, and eloquently called for a change for the better. He got quite a round of applause for it, too. It's remarkably inspiring, so if you have a few minutes, give it a listen.

Wednesday, April 02, 2008

A whole new breed of penguin

Yesterday, BBC released some short clips about a newly discovered colony of penguins. My apologies to those of you that have YouTube blocked -- just search for 'penguins' on the BBC's website, and it's in the sidebar.

There were some great pranks from other sources yesterday. Probably the biggest was YouTube modifying the entire front page so that all the featured videos linked to Rick Astley's "Never Gonna Give You Up," instead of the video actually posted. In other words, they rickrolled their entire userbase. The name of the user posting the video was "YTRickRollsU," and the user page was a "Happy April Fools Day 2008" page.

I don't know what poor Mr. Astley did to deserve all the attention, but I hope he didn't sell his soul for it.

Oh, it looks like Robert Mugabe, the tinpot dictator of once-prosperous Zimbabwe, may have actually lost the election. This in spite of a significant campaign of media control and intimidation against his opponents. True, they have an inflation rate of 100,000%, some 80% unemployment, and the lowest life expectancy in the world, but it's still rather remarkable for someone as entrenched as Mugabe to actually lose an election. Here's hoping that Tsvangirai is more competent than his predecessor--fortunately for him, that's a wonderfully low bar.

I meant to do my taxes two days ago. I haven't forgotten, I just keep leaving necessary forms in all the wrong places.

Tuesday, April 01, 2008

The Red Army Choir goes South

Once upon a time, in a far away, cold northern land, there was a huge army that served the communist overlords. They were known as the "Red Army" or the "Soviet Army". Americans used to think that someday, the Red Army was going to invade the United States. When I was in elementary school, they used to do drills where we'd all have to duck under our desks. This was supposed to be helpful for when the Russians dropped a nuclear bomb on our school, though in retrospect it probably wouldn't have done any good. We also used to read scary stories about Russians cutting up American flags and then teaching all the children that freedom was bad. I think they were trying to train us up as future guerilla fighters, just in case.

Anyway, back in those glorious days, the Russians had a massive men's choir called the Red Army Choir. That's not actually what the choir was called. The full name was "Дважды Краснознамённый ордена Красной Звезды академический ансамбль песни и пляски Советской армии имени А.В.Александрова" which means "the Academic Ensemble of Song and Dance of the Soviet Army, Bearer of Two Orders of the Red Banner and the Order of the Red Star named after Alexandrov." Anyway, they would sing the Soviet anthem and a lot of other patriotic, communist songs for the purpose of inspiring the plebeian masses.

Anyway, it turns out that the Soviet Union kind of sort of collapsed, and singing patriotic songs about it fell out of favor. But that still leaves you with a perfectly good choir who now have a lot of free time on their hands. So what should they do about it?

Enter the Leningrad Cowboys. They're a Finnish rock band who have enormous hair and ridiculous sunglasses, and who thought it would be just hilarious to ... frankly, words fail me. You're just going to have to watch it.

The Leningrad Cowboys and The Red Army Choir singing "Sweet Home Alabama"

Truly, reality is often stranger than fiction.