diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-11-06 23:37:21 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-11-06 23:37:21 +0000 |
| commit | 1c9ab1ba692cde7ebcd98b13811b274cf9e7a00b (patch) | |
| tree | 885fef17d365796ba5ddb605a02317a2a9ec8ed4 | |
| parent | 04c5ecb4ee60bf05dbfff8f41f18c4f17f49c2de (diff) | |
| download | rockbox-1c9ab1ba692cde7ebcd98b13811b274cf9e7a00b.zip rockbox-1c9ab1ba692cde7ebcd98b13811b274cf9e7a00b.tar.gz rockbox-1c9ab1ba692cde7ebcd98b13811b274cf9e7a00b.tar.bz2 rockbox-1c9ab1ba692cde7ebcd98b13811b274cf9e7a00b.tar.xz | |
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
| -rw-r--r-- | apps/playlist.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index e514530..3b96225 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]; |