Math question involving probability - not homework!

Mardeth

Platinum Member
Jul 24, 2002
2,608
0
0
So while listening to music from Winamp with shuffle on, I got to thinking. If you had a playlist of 1000 song, for example. What would be the EV for how many songs youd need to listen to before youd had listened to every song. This is presuming that you can listen to any song an infinite times and back to back and the shuffle would be totally random.
 
Last edited:

Legendary

Diamond Member
Jan 22, 2002
7,019
1
0
After every song, does Winamp choose 1 of 999 songs or 1 of 1000 songs (including the song just played)?
 

DesiPower

Lifer
Nov 22, 2008
15,299
740
126
So while listening to music from Winamp with shuffle on, I got to thinking. If you had a playlist of 1000 song, for example. What would be the EV for how many songs youd need to listen to before youd had listened to every song. This is presuming that you can listen to any song an infite times and back to back and the shuffle would be totally random.

your question has the answer
 

Mardeth

Platinum Member
Jul 24, 2002
2,608
0
0
your question has the answer

If your implying the the answer is infite your wrong. Maybe I explained it badly.

Short example:

Your playlist of 4 songs:

Song 1
Song 2
Song 3
Song 4

You start to play them on shuffle. Starting from song 3 and continuing -> 2 -> 2 -> 4 -> 2 -> 1. So it took 6 songs to play them all. Now how about for a 1000. How do you calculate it?
 

DrawninwarD

Senior member
Jul 5, 2008
896
0
0
If your implying the the answer is infite your wrong. Maybe I explained it badly.

Short example:

Your playlist of 4 songs:

Song 1
Song 2
Song 3
Song 4

You start to play them on shuffle. Starting from song 3 and continuing -> 2 -> 2 -> 4 -> 2 -> 1. So it took 6 songs to play them all. Now how about for a 1000. How do you calculate it?

If it can repeat songs, it is possible that it won't choose some one song even after thousands and thousands of songs have played. There's also the chance that it will only play everything just once. So yeah...
 

Mardeth

Platinum Member
Jul 24, 2002
2,608
0
0
If it can repeat songs, it is possible that it won't choose some one song even after thousands and thousands of songs have played. There's also the chance that it will only play everything just once. So yeah...

If it was simple I wouldnt be asking :).
 

daniel1113

Diamond Member
Jun 6, 2003
6,448
0
0
If it can repeat songs, it is possible that it won't choose some one song even after thousands and thousands of songs have played. There's also the chance that it will only play everything just once. So yeah...

That's why any calculation would be within a certain confidence interval (say, 95 or 99%).
 

CoinOperatedBoy

Golden Member
Dec 11, 2008
1,809
0
76
After every song, does Winamp choose 1 of 999 songs or 1 of 1000 songs (including the song just played)?

1 of 1000

If this is the case, then the expected value is 1 / (1 / 1000) = 1000.

Edit: Nevermind, I misread your question. This would be the result if you wanted to calculate the EV for how many songs you would have to listen to before you heard one in particular, not all of them.
 
Last edited:

CoinOperatedBoy

Golden Member
Dec 11, 2008
1,809
0
76
Okay, so think of it this way. Play one song. Then play another until you hear a different one. Since there are 999 remaining, this will take on average 1/(999/1000) or 1000/999 plays. Then play until you hear one of the remaining 998, which should take 1000/998 plays. Continue until you've played them all. This could be expressed as

sum 1000 / j, j=1 to 1000

or

1000 * sum 1 / j, j=1 to 1000

...which works out to be approximately 7485.47, as others have already calculated. Juked got it first.
 

QuantumPion

Diamond Member
Jun 27, 2005
6,010
1
76
If the songs can repeat the solution is 1-[(playlist size -1)/(playlist size)]^(number of songs played)

library = 1000
Code:
songs played    chance of each song being played	
1	             0.001
10	             0.00995512
100	             0.095207853
1000	             0.632304575
3000	             0.950287606
5000	             0.993278888
10000	             0.999954827
 
Last edited:

frostedflakes

Diamond Member
Mar 1, 2005
7,925
1
81
My understanding is that the shuffle feature in Winamp (and maybe it's the same in other media players) actually creates a random playlist of all the songs. So say you have five songs, Winamp will just create a playlist where each of these songs is played once, but randomize the order

Song 3
Song 2
Song 5
Song 4
Song 1

As opposed to just randomly selecting songs, which could lead to a situation like this

Song 1
Song 1
Song 3
Song 4
Song 2

So this means that if you have a library of 1000 songs and you let the shuffle playlist run its course, you'll hear all of the songs only once. Then at the end it just cycles back to the beginning of the shuffle playlist.

Hope this is correct and I understood the question correctly.
 

QuantumPion

Diamond Member
Jun 27, 2005
6,010
1
76
Hmm, 7500 sounds about right. Thanks people!

I don't think 7500 is right. The chance for any particular song to play at any time (if they can repeat and are random) is 1/1000, you aren't playing 1000 songs then removing one song from the playlist. The chances of playing each song once is 95% after 3000 songs and 99% after 5000 songs. It will never be 100%.
 
Last edited:

Mardeth

Platinum Member
Jul 24, 2002
2,608
0
0
My understanding is that the shuffle feature in Winamp (and maybe it's the same in other media players) actually creates a random playlist of all the songs. So say you have five songs, Winamp will just create a playlist where each of these songs is played once, but randomize the order

Ive noticed that it plays same songs more than 1/(number songs in playlist). And also noticed that if press "next song", then "previous song" and again "next song" the songs stay the same.

In any case, it is beside the point. My question is not mediaplayer or playlist specific, it just made me wonder how you would calculate such odds.
 

Mardeth

Platinum Member
Jul 24, 2002
2,608
0
0
I don't think 7500 is right. The chance for any particular song to play at any time (if they can repeat and are random) is 1/1000, you aren't playing 1000 songs then removing one song from the playlist. The chances of playing each song once is 95% after 3000 songs and 99% after 5000 songs. It will never be 100%.

This reminds of an anciet greek math problem:

You have human racing against a turtle. The turtle has a 10 meter head start and the human runs 10 times as fast as the turtle (for simplicity).

They start. By the time the human reaches the point where from the turtle started, the turtle is 1 meter a head. Now the human runs that one meter and the turtle is now 10 centimeters ahead. Human runs that 10 cm and the turtle is 1 cm ahead. And so on and so on. We know that the human passes the turtle but if you look at it, the human just gets infinitely closer but never passes the turtle...
 

Chris27

Member
Sep 19, 2005
140
0
0
I don't think 7500 is right. The chance for any particular song to play at any time (if they can repeat and are random) is 1/1000, you aren't playing 1000 songs then removing one song from the playlist. The chances of playing each song once is 95% after 3000 songs and 99% after 5000 songs. It will never be 100%.

You are not calculating probability right. The probability that event e occurs = SIZE(sets where e occurs)/SIZE(all sets). Now if we take e to be the event that all songs are played at least once after n songs are played, we have P(e occurs) = ((n + 1000 - 1000 -1) choose (1000 - 1))/ ((n + 1000 - 1) choose (1000 - 1))

so for n = 3000 => 67%
n = 5000, => 80%
n = 7486, => 88%

Now, if we are talking about expected values as proposed by the topic of this thread, see CoinOperatedBoy's explanation.