Apple iTunes’ Party Shuffle algorithm revealed: how song ratings affect tracks’ play chances
Monday, August 29, 2005 - 08:39 AM EDT"iTunes' available song ratings of 1 to 5 stars allow users to quickly find their favorites and help the Party Shuffle feature play more of what they like most. This article explores the algorithm iTunes uses to pick what comes next in the playlist," Brian E. Hansen writes for OminNerd. "After hearing one artist played over and over during a shuffled play of your entire music library in iTunes you may think your player has a preference of its own. Apple claims the iTunes' shuffle algorithm is completely random. The shuffle algorithm chooses songs 'without replacement.' In other words, much like going through a shuffled deck of cards, you will hear each song only once until you have heard them all... or until you have stopped the player or selected a different playlist."
Hansen writes, "iTunes Party Shuffle is a different matter. Its algorithm selects songs 'with replacement,' meaning the entire deck of cards is reshuffled after each song is played. The play higher rated songs more often option does exactly what it says, but how much preference is given to higher rated songs?"
Full article here.

I think most people don't actually want a pure random setting. I dislike hearing a song too often and I also like to hear my favorite songs more often, but also not repetitively. So, I have set up 5 playlists that give me what I think is a good mix of my songs. They are as follows:
1: rated 2 and 25 rated by least recently
2: rated 3 and 73 rated by least recently
3: rated 4 and 70 rated by least recently
4: rated 5 and 32 rated by least recently
playlist is any of playlists 1, 2, 3, or 4 with live updating
The numbers (25, 73, 70, and 32) come from multiplying the number of songs in each category by the rating-1, so it is essentially the same as the "play higher rated songs" in PartyShuffle. I leave 1 rated songs for ones that I don't listen to very often. This way, I get a random selection of my music that does not repeat a song until I have more-or-less gone through the rest of them in that rating. And, it generally plays the 5 rated songs about 4 times more than the 1 rated songs.
I found that I do not like the random feature since it often will play one song significantly more than another song. Eventually, it would even out, but in the range of 20 times playing a song, there can be a large discrepancy and I haven't heard some songs in longer than I'd like.
I think the general random setting should randdomly select from a pool of the 20% least recently played songs with live updating. At least, that is how I wish my CD playing in my car worked - I hear the same song played twice in a row about every 10-15 hours of listening.