summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--playtree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/playtree.c b/playtree.c
index 373bbfb575..e0c92b2f14 100644
--- a/playtree.c
+++ b/playtree.c
@@ -525,7 +525,7 @@ play_tree_rnd_step(play_tree_t* pt) {
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--;