summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/playlist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index e514530aea..3b96225b17 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -727,7 +727,7 @@ static int randomise_playlist(struct playlist_info* playlist,
727 for(count = playlist->amount - 1; count >= 0; count--) 727 for(count = playlist->amount - 1; count >= 0; count--)
728 { 728 {
729 /* the rand is from 0 to RAND_MAX, so adjust to our value range */ 729 /* the rand is from 0 to RAND_MAX, so adjust to our value range */
730 candidate = rand() / (RAND_MAX / (count + 1)); 730 candidate = rand() % (count + 1);
731 731
732 /* now swap the values at the 'count' and 'candidate' positions */ 732 /* now swap the values at the 'count' and 'candidate' positions */
733 store = playlist->indices[candidate]; 733 store = playlist->indices[candidate];