Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: random (Read 11029 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

random

(fb2k v0.6b7)
running foobar2000.exe /rand to pick a random track seems to select the same track as is currently playing far more frequently than I would suspect is statistically likely. This seems to happen when skipping through many tracks in a row, so songs are still within the first half-second or so of playback. This may also just be because that is when I perform this action the most.
I haven't checked if this is the same when pressing Random, but I assume so.
(I have a hotkey setup to run the above command)

I guess it is possible that I just have freakish luck or something, but I thought I'd draw attention to this so it can be checked out sometime when you have nothing else to do (heh), Peter.

random

Reply #1
rejj, it's probably just your imagination.

Foobar uses Mersenne Twister to generate pseudo-random numbers, which has been proven to be more than adequate.

However, if you find some statistically valid evidence that foobar's prng isn't behaving, you're welcome to share it.

random

Reply #2
Make a playlist with 10 tracks, repeatedly click random and foobar will sometimes play tracks 2-3 times in a row.
.

random

Reply #3
make a playlist of 10 songs, then repeatedly click random and take note of every song it plays.  do this for about 100 plays, and post here with the playlist and the song order.

random

Reply #4
lol maybe the random generator for a sequence of <your sequence> is borked?

random

Reply #5
lol

random

Reply #6
Quote
Make a playlist with 10 tracks, repeatedly click random and foobar will sometimes play tracks 2-3 times in a row.

I did say "statistically valid", didn't I?


random

Reply #7
Quote
I did say "statistically valid", didn't I?


if its statistics you want then...

test: playlist with 10 songs, random button pressed 300 times.

results/analysis:
Code: [Select]
song no/no times/%age
1/36/12%
2/28/9%
3/34/11%
4/27/9%
5/25/8%
6/26/9%
7/27/9%
8/36/12%
9/33/11%
10/28/9%


total: 300 songs

my opinion is that the selection was biased to umbers 1,3,8,9.

repitions (original point):
Quote
1 song twice   39
1 song thrice   5


actual chance of one song twice is 0.1*0.1 = 0.01 or one in 100, so it should have oly happened three times, not 40, correct me if im wrong.

note: twice includes songs played three times in a row.

raw results:
Quote
9
3
6
1
4
7
6
3
1
7
6
3
1
5
5
2
3
1
2
3
7
4
5
9
10
9
9
4
2
7
4
10
8
4
9
3
5
3
10
1
1
4
6
6
2
8
10
3
10
1
3
5
2
8
5
6
5
2
1
3
8
7
3
5
10
3
10
5
8
7
6
8
9
4
7
8
9
9
9
1
6
5
7
8
3
2
3
7
7
6
10
1
1
1
2
4
7
10
5
2
2
8
1
4
3
6
9
9
9
1
10
10
5
9
9
9
5
2
8
4
4
10
8
1
10
9
7
9
6
9
8
7
8
9
5
10
4
8
8
3
8
3
4
8
1
1
4
2
10
3
6
8
7
1
7
9
3
8
5
5
2
7
3
9
8
8
6
7
1
9
9
3
9
5
4
4
8
7
3
7
2
10
8
1
5
1
8
10
10
4
8
3
3
4
8
7
7
8
10
10
4
9
1
6
9
6
2
7
8
3
4
1
9
5
6
10
1
1
3
8
8
10
4
2
1
9
10
6
9
3
7
6
1
2
2
7
6
5
8
3
3
8
4
4
5
7
7
6
10
6
5
1
1
1
8
2
3
2
3
2
2
6
1
10
1
5
8
2
2
1
5
9
9
2
10
8
9
1
4
4
2
1
2
10
6
2
6
1
4
9
6
8
10
3
4
3
3
5
7
6
.

random

Reply #8
Quote
my opinion is that the selection was biased to umbers 1,3,8,9.

That's "sharpshooter's fallacy" - you do the test, then search for deficiences. Of course, it is likely that for some numbers the prng *will* seem biased, otherwise it would be non-random

If you did another trial, and got the same results, for the same numbers - only then it would have meant something.

As for the songs repeating "too often", there doesn't seem to be anything wrong with your data, at least for confidence levels over ~85%.

Did you use any statistical procedures to evaluate the data?

random

Reply #9
I'd say with a sample of only 300 hits, you're likely to see some bias, whether it's real or not.

Of course, if it's being repeatedly biased toward the same numbers in multiple tests of 300 hits, then there might be a problem.

random

Reply #10
Quote
If you did another trial, and got the same results, for the same numbers - only then it would have meant something.

I will do maybe noe actually, I'll see what happens. I though 300 repitions would be acurate enough but hey Im happy to do some more.

Quote
As for the songs repeating "too often", there doesn't seem to be anything wrong with your data, at least for confidence levels over ~85%.


What do you mean exactly? Its just that the same songs being twice in a row happens too much, or dont you agree? As far as Im concerned the probability of the same song being played twice is 1/100 whilst the relative probability in this test was 39/300 = bias, doesnt it?

I could work out when songs go a,b,a but I cant really be bothered, though I think that happened/happens a bit too.

Quote
Did you use any statistical procedures to evaluate the data?


If you mean standard deviation etc. no, dont see the usefulness. I didnt take up Statistics at college so I only have limited knowledge, I remember upto standard deviation but thats about it.. I put this into excel so if there's anything you want me to do it wouldnt take long.

I will do another 300 repitition test though, we'll see.
.

random

Reply #11
done another test (0.6b8):

Quote
plno/no times/percent

1/27/9%
2/25/8%
3/30/10%
4/30/10%
5/39/13%
6/29/10%
7/28/9%
8/29/10%
9/37/12%
10/26/9%


So i guess there is little bias.

But this time:
Quote
same song twice: 31
same song thrice: 1


Slightly lower but still quite high.

Raw data:

Quote
4
4
6
3
4
8
7
6
2
8
3
7
9
10
10
4
4
9
1
6
3
5
8
3
9
3
3
3
5
9
6
7
5
6
9
3
7
5
1
5
3
5
4
1
5
1
6
5
3
8
4
8
2
9
5
9
4
4
2
8
1
9
5
10
1
10
3
3
4
8
4
6
9
1
2
8
6
7
8
10
10
6
10
6
3
9
9
10
6
6
2
5
7
5
1
6
9
3
2
8
10
9
6
6
10
9
9
10
7
1
1
4
7
9
9
5
7
4
9
9
3
6
9
6
3
7
7
6
10
3
4
1
8
5
4
4
8
10
1
8
8
2
9
5
9
8
1
5
1
9
3
2
8
9
4
5
9
5
5
10
6
7
5
3
5
2
2
7
10
4
9
3
3
9
5
2
7
5
2
10
5
5
8
3
10
10
1
10
7
6
5
7
4
8
4
3
10
8
9
9
5
9
5
10
6
1
6
8
7
2
5
3
4
1
2
9
1
2
2
8
4
3
2
5
7
2
2
10
7
8
6
4
6
10
5
7
10
5
2
5
3
1
7
5
1
9
8
10
2
9
4
4
1
6
6
5
5
2
7
5
1
2
10
1
9
7
2
4
8
7
6
8
7
9
8
1
2
1
1
3
3
4
7
9
5
9
8
4
1
8
6
8
5
7
4
3
4
7
3
6
.

random

Reply #12
I have a playlist with 1999 songs. Should give a little different picture than 10 songs, no? I hit Random 500 times and recorded which songs were played back.  I'm not sure if I were just letting the songs play and automatically go to the next random song would give the same results or not.  From what I see in the results, and from my own general idea of random's behaviour from having listened to it quite often on shuffle I'd say they're probably the same as I've noticed the same general behavior in this test.  I'm in the 'random needs work' pool of people, generally speaking it isn't quite as random as I'd like.  Basically, it plays the same songs too often, and picks songs that are too close together in the list too often.  In this 500-song test, here are songs played twice (or three times):

62, 76, 84, 90, 99, 101-three times, 170, 177, 185, 217, 226, 230, 266, 336, 338, 366, 370-three times, 376, 441, 455, 485, 490-three times, 507, 551, 566, 603, 653, 670, 713, 783, 787, 801, 816, 837, 1100, 1116, 1136, 1140, 1181, 1200, 1253, 1260, 1282, 1324, 1382, 1399, 1408, 1472, 1484, 1518, 1609-three times, 1677, 1702, 1722, 1822, 1836, 1901, 1921, 1950, 1998

That's 60 songs played twice or more, out of 500 songs played.  That's a little much if you ask me, gets annoying.  Especially since they seemed to repeat within close proximity in play order.  Which brings another point up, songs getting picked which are in close proximity on the playlist, i.e. probably songs from same album or artist.  This seems to happen quite often too, songs which are very close to each other on the list get played close to one another in the 'random' playback order.  Also annoying.  Not because they're from the same artist or album, but because the other was played quite recently.  If you take a look through the track numbers listed you'll see it happens on a few occasions, sometimes one right after the other, which seems odd with a playlist of this size.

Perhaps a 10-track FIFO (or x-track) could be maintaned, and it could check whether the next track to be played is within a 10% window (or x%) of total tracks, or whether it is from the same artist or album, and if any of those conditions were true, pick another random one instead.  That way neighbouring tracks would at least be spread out a little more in the playback order.  Would also be nice if it stored a bit for each track during the current play-session that would indicate whether a track had been played or not so you won't get repeated tracks unless you hit stop at some point, which would reset the 'played' bits.

random-test.txt containing track numbers as played
random-test-sorted.txt containing sorted numbers, makes it easy to spot twice/thrice

<edit> just amplified the neighbouring-tracks point, with reference to file.

random

Reply #13
Quote
actual chance of one song twice is 0.1*0.1 = 0.01 or one in 100, so it should have oly happened three times, not 40, correct me if im wrong.

You're completely wrong. Look up the birthday paradox to understand why. Your problems are that foobars random is really random - you're asking for nonrandom playback.

random

Reply #14
but it's labelled Shuffle, so I guess it should either be fixed so it is actually shuffling the songs, or it should be renamed Random.  After all, if you grab a deck of cards and shuffle them and deal them out, you don't magically give the deck three more ace of spades, or take out all the sixes, or any other nonsense.  You simply mix them up and the order in which they're dealt is different.  There's still just the same 52 cards there.  It would be quite nice to actually have a real shuffle that exhibits less patterns than the current one does.  I know people keep on stating that we could simply sort the playlist with the 'random' sort and just playback that randomized playlist.  That solves one problem, the repeated tracks problem.  But it doesn't solve the other, in which tracks are picked out, well, not randomly enough.  I don't want to hear two or three tracks in a row from the same album, or perhaps artist, and that happens quite often with the current situation.

random

Reply #15
Quote
You're completely wrong. Look up the birthday paradox to understand why. Your problems are that foobars random is really random - you're asking for nonrandom playback.

whatever, i give up...
.

random

Reply #16
I don't see any statistically significant bias, based on what you've posted.

song no/no times/%age
1/36/12%
2/28/9%
3/34/11%
4/27/9%
5/25/8%
6/26/9%
7/27/9%
8/36/12%
9/33/11%
10/28/9%

1/27/9%
2/25/8%
3/30/10%
4/30/10%
5/39/13%
6/29/10%
7/28/9%
8/29/10%
9/37/12%
10/26/9%

It breaks down like this:
track #/ percentage relative to ten (1st run) / percentage relative to ten (2nd run)
1 / > / <
2 / < / <
3 / > / -
4 / < / -
5 / < / >
6 / < / -
7 / < / <
8 / > / -
9 / > / >
10 / < / <

The only one with a hit percentage greater than 10 in both runs was #9.  It's definitely not biased toward the others, and with only two runs, I don't think I'd be willing to say that it's biased toward #9.  (especially, since in the first run it only had an 11% hit ratio, and in the second run it only had a 12% hit ratio)

random

Reply #17
Quote
You're completely wrong. Look up the birthday paradox to understand why. Your problems are that foobars random is really random - you're asking for nonrandom playback.

I don't know about birthday paradox, but i worked out why i was wrong:

0.01 is the probability of a partitcular sequence of songs (e.g. 3,8) not ANY repeated song.

So,

P(last song repeated)
=P((1 AND 1) OR (2 AND 2) ... OR (10 AND 10))
=(0.1*0.1) + (0.1*0.1) ... + (0.1*0.1)
=0.01*10
=0.1

300*0.1
=30

So 30 songs repeated twice in a row is roughly correct for 300 repititions, so there is nothing wrong with the randomness of fooobar's shuffle in this light.

I'll do another test to eliminate shuffle from being biased to 9 sometime today, i'll only bother reporting back if it comes out with a >10% share again, which i don't think it will.
.

random

Reply #18
Quote
I don't know about birthday paradox, but i worked out why i was wrong:

Yep. The birthday paradox is the observation that when you are in a room with x people, the chance that two have the same birthday is greater than 50% for x=23, and not 182 or 365 as you'd intuitively expect. You figured out the maths yourself I see

random

Reply #19
Quote
Yep. The birthday paradox is the observation that when you are in a room with x people, the chance that two have the same birthday is greater than 50% for x=23, and not 182 or 365 as you'd intuitively expect. You figured out the maths yourself I see

I looked it up but it seems i would have to read it properly to understand it. I do get though that x=182 is for one  particular person having the same birthday as another person in the room, not any two people.

I also realised for the test (same song twice) it would probably have been fairer to do random, random, stop, random random, stop etc. and then record the numbers in pairs, the same way you would do it with a die when expecting a particular sequence.

Anyway, the results of the new test were:

1/34/11%
2/22/7%
3/28/9%
4/37/12%
5/32/11%
6/24/8%
7/38/13%
8/28/9%
9/21/7%
10/36/12%

So all is ok.

btw curious george, you may have misunderstood me when I said "So i guess there is little bias." i meant there was no significant bias, not that there was a bit of bias.
.

random

Reply #20
I know a couple of statistical tests, i'll try them out. I will report back in a little while.
superdumprob
____________________________________________

"If we knew what it was we were doing, it would not be called research, would it?" - Albert Einstein

random

Reply #21
OK, I just carried out a chi-squared test on the hypothesis that there was a bias towards any numbers (i.e. they are not uniformly distributed). It is set up as follows:

Hypotheses:

Null hypothesis: The distribution of numbers is uniform.
Alternative hypothesis: The distribution of numbers is not uniform.

Level of test:

95% is the standard level.

Degrees of freedom, v:

There are nine degrees of freedom as there are ten classes and one restriction (one of the values can be worked out if you know nine of them and the total).

Rejection criterion:

If the calculated chi-squared calue is greater than the chi-squared value for 9 degrees of freedom at 95% then we reject the null hypothesis in favour of the alternative.

i.e. if the calculated chi-squared value is less than 16.919 (looked up on a table i have) then we accept the null hypothesis that the numbers are uniformly and randomly distributed and that there is no bias towards any numbers.

Chi-squared calculation:

chi-squared = sum of  [{|observed value - corresponding expected value|^2}/expected value]

= [{|34 -30|^2}/30] + [{|22-30|^2}/30] etc

=11.933

Therefore we accept the null hypothesis that there is no bias in the distribution of the numbers.

In statistics anything stated with much less that 95% certainty is disregarded.

Also, I know very little of the Mersenne Twister method but it is very widely used for it's speedy production of very near random numbers. All random number generators on computers create lists of pseudorandom numbers. No method is perfect on a computer, they're just very close.

Oh, I only typed out the method so people could see what was going on...

Thanks for your time
superdumprob
____________________________________________

"If we knew what it was we were doing, it would not be called research, would it?" - Albert Einstein

random

Reply #22
So this is what we have: the "random" in is foobar *random* and it plays songs randomly, meaning that a song can be played more frequently than other.
This is what many people want: the "random" in foobar should be actually "shuffle", so it'd just play the playlist shuffled (every song ONLY once before playing the playlist again.)
This is the solution most people here would give: Randomize playlist and turn "shuffle" off.
This is what many people say to that: I don't want to randomize my playlist, because then I can't find the songs easily, etc.

I'm one of those people who DON'T want to shuffle their playlist, but I don't bitch about the random/shuffle thing. It is what it is and that's it.

One thing I'd like to say though: I'm at my relatives right now and I have here only 310 songs (total time: 21hrs). I have them all in my playlist. I've kept foobar playing that playlist for about 50hrs right now, and it has played only 136 different songs. So there's 174 songs it hasn't played. Nothing else to say.

random

Reply #23
You've been watching it/listening for 50 hours solid?  Only 136 songs, eh? Well that's pseudorandomness for you.
superdumprob
____________________________________________

"If we knew what it was we were doing, it would not be called research, would it?" - Albert Einstein

random

Reply #24
Quote
I've kept foobar playing that playlist for about 50hrs right now, and it has played only 136 different songs.

How do you know it?