From 1c9ab1ba692cde7ebcd98b13811b274cf9e7a00b Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Sat, 6 Nov 2004 23:37:21 +0000 Subject: Reverted to the earlier modulo method for creating a range of random numbers, since the new method could generate too large numbers git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5386 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, for(count = playlist->amount - 1; count >= 0; count--) { /* the rand is from 0 to RAND_MAX, so adjust to our value range */ - candidate = rand() / (RAND_MAX / (count + 1)); + candidate = rand() % (count + 1); /* now swap the values at the 'count' and 'candidate' positions */ store = playlist->indices[candidate]; -- cgit v1.2.3