[Rhythmbox-devel] Random song choice



Hi,

I have noticed that rhythmbox, when in "random" mode, will sometimes
play the same song twice in a row. This is expected, with probability
1 / number of songs in library, you will play the same song twice in a
row with a truly random selection. However, it is somewhat annoying.
Is there a reason this hasn't been changed to the following
pseudocode:

int n; /* size of current playlist */
int cur; /* index in playlist of current song */
int next;

/* use high-order bits to generate random number between 0 and max-1 */
int getrand(int max) {
 return (int) ((max * 1.0 * (rand() / RAND_MAX * 1.0));
}

next = getrand(n);
while (n > 1 && next == cur) next = getrand(n);

Thanks,
Peter


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]