summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-07-23 10:45:16 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-07-23 10:45:16 +0000
commit12bf7f39b1f9ab5cb60a467f934557fce65b1ddb (patch)
tree1c9b860483e7371e11898dee515b24abe3d791f0 /apps/playlist.c
parentdd0b12c9acd1fe840e43fb7b8c67304c1f2211b1 (diff)
downloadrockbox-12bf7f39b1f9ab5cb60a467f934557fce65b1ddb.tar.gz
rockbox-12bf7f39b1f9ab5cb60a467f934557fce65b1ddb.zip
Slightly better randomness when shuffling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4922 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index cfa49d10ea..e3dc62625a 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -721,7 +721,7 @@ static int randomise_playlist(struct playlist_info* playlist,
721 for(count = playlist->amount - 1; count >= 0; count--) 721 for(count = playlist->amount - 1; count >= 0; count--)
722 { 722 {
723 /* the rand is from 0 to RAND_MAX, so adjust to our value range */ 723 /* the rand is from 0 to RAND_MAX, so adjust to our value range */
724 candidate = rand() % (count + 1); 724 candidate = rand() / (RAND_MAX / (count + 1));
725 725
726 /* now swap the values at the 'count' and 'candidate' positions */ 726 /* now swap the values at the 'count' and 'candidate' positions */
727 store = playlist->indices[candidate]; 727 store = playlist->indices[candidate];