changeset 13884:a6b4bfa42178

fix "last file is always played last" bug.
author reimar
date Fri, 05 Nov 2004 22:45:16 +0000
parents e03eefa560d8
children 1f278d672654
files playtree.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/playtree.c	Fri Nov 05 22:37:36 2004 +0000
+++ b/playtree.c	Fri Nov 05 22:45:16 2004 +0000
@@ -525,7 +525,7 @@
 
   if(!count) return NULL;
   
-  r = (int)((count-1.0) * rand() / RAND_MAX);
+  r = (int)((float)(count) * rand() / (RAND_MAX + 1.0));
 
   for(i = head ; i  ; i=i->next) {
     if(!(i->flags & PLAY_TREE_RND_PLAYED)) r--;