January 26, 2008

shuffle off to buffalo........


shuffle.

how does shuffle work?

groundcat & i like to play music when we go to bed. it helps us fall asleep. we play music on the iMac, which is attached to the stereo speakers. we have each created play lists within itunes, full of all the mellow, relaxing "night music" we love.

my "jen's night mix" has about 2 days worth of music. so i select this mix and then play it on "random shuffle". it's like listening to my own radio station and i love it.

but when i can't fall asleep, i lay there listening to each new song that comes up, and start to wonder, "how in the hell does shuffle really work?" how does a software program like itunes program itself to be "random"? it can't possibly be random, there has to be some logic in there!

if anyone can find me an actual explanation, i will...... i don't know! i'll give you a prize! or make you dinner! or maybe i'll finally divulge my horrible high school nickname!

(rachel, sladjana, etc.... keep your traps shut as to the nickname!)

5 comments:

copaX said...

lemme see if I can explain this in simple terms...

basically there is no real thing as computerized randomization. It's just a really really close approximation.

Starting at a high level, "shuffling" is done by using some kind of algorithm to reorder a list. One kind of algorithm involves picking a random number between 1 and the number of items in the list that haven't been "shuffled" yet, which when it first starts is the full number of items in the list, then taking the item in that random number position and swapping it with the last item in the list. It keeps doing this, as the pool of numbers it uses to pick a random number from eventually decreases. Once it's done,the list is in "random" order.

Now, the key part of this is the computer/ipod/whatever being able to pick a "random" number. This is technically impossible. What modern computers do is have a really really long list of numbers created, randomized by human effort. The computer uses this really big list of numbers to choose from. The key is when somebody asks for a random number they tell it where in the list to start. Then every time they ask for a random number again, the computer just steps through the list.


So yeah, I probably just really confused you.

GLITTERGIRL said...

that made total and complete sense to me.

copaX said...

well there ya go....now what do I win?

rachel said...

I honestly can not remember your nickname in highschool.... hmmmmmmmm. I'm sure it will come to me though.

copaX said...

if you come up with it, rachel, let me know, because I have a feeling jen's gonna welch on her part of the bargain.