[xiph-cvs] cvs commit: ices/src/playlist rand.c
Brendan
brendan at xiph.org
Thu Aug 14 09:16:59 PDT 2003
brendan 03/08/14 12:16:58
Modified: src/playlist rand.c
Log:
Borrow Karl's random playlist fix.
Revision Changes Path
1.2 +1 -1 ices/src/playlist/rand.c
Index: rand.c
===================================================================
RCS file: /cvs/ice/ices/src/playlist/rand.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -u -r1.1 -r1.2
--- rand.c 21 Jun 2001 21:25:25 -0000 1.1
+++ rand.c 14 Aug 2003 16:16:58 -0000 1.2
@@ -103,7 +103,7 @@ scramble (FILE *fp, FILE *out)
n = size;
while (n > 1) {
- int d = (int)(((double) rand() / RAND_MAX) * n);
+ int d = (int)((double)size * rand() / (RAND_MAX + 1.0));
char *temp = table[d];
table[d] = table[n-1];
table[n-1] = temp;
<p><p>--- >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 'cvs-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 commits
mailing list