From 12bf7f39b1f9ab5cb60a467f934557fce65b1ddb Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Fri, 23 Jul 2004 10:45:16 +0000 Subject: Slightly better randomness when shuffling git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4922 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apps') 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, for(count = playlist->amount - 1; count >= 0; count--) { /* the rand is from 0 to RAND_MAX, so adjust to our value range */ - candidate = rand() % (count + 1); + candidate = rand() / (RAND_MAX / (count + 1)); /* now swap the values at the 'count' and 'candidate' positions */ store = playlist->indices[candidate]; -- cgit v1.2.3