Slightly better randomness when shuffling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4922 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
dd0b12c9ac
commit
12bf7f39b1
1 changed files with 1 additions and 1 deletions
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue