[vorbis-dev] fixing shuffle in ogg123
MC Spanky
mcspanky at mac.com
Mon Dec 11 07:30:33 PST 2000
On 11 Dec 2000, Guillaume Cottenceau wrote:
>
> There is a bug in the shuffle of ogg123 which was here at least until the
> CVS version of 3 days ago. Here's our fix: (it seems to be not perfectly
> equiprobable but at least fixes the old one which sometimes gives two
> times the same song and never the other song)
...
> + int j = i * ((float) rand() / RAND_MAX);
> + int temp = p[j]; p[j] = p[i]; p[i] = temp;
Actually, in that first line, I think you want "j = (i + 1) *
...". Otherwise, for example, the last song will NEVER be the last
command line argument. And you may want to divide by RAND_MAX + 1, not
plain RAND_MAX.
- Spanky
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev
mailing list