aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--NEWS1
-rw-r--r--src/playlist.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 0753091e9..577ba3fe4 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ MPD 0.14.1 - not yet released
* fix minor memory leak in decoder_tag()
* fix cross-fading bug: it used to play some chunks of the new song twice
* playlist: fix assertion failure during playlist load
+* playlist: implement Fisher-Yates shuffle properly
* use custom PRNG for volume dithering (speedup)
* detect libid3tag without pkg-config
diff --git a/src/playlist.c b/src/playlist.c
index 621947544..96eff0a6f 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1097,7 +1097,7 @@ static void randomizeOrder(int start, int end)
clearPlayerQueue();
for (i = start; i <= end; i++) {
- ri = g_rand_int_range(g_rand, start, end + 1);
+ ri = g_rand_int_range(g_rand, i, end + 1);
if (ri == playlist.current)
playlist.current = i;
else if (i == playlist.current)
@@ -1180,7 +1180,7 @@ void shufflePlaylist(void)
}
/* shuffle the rest of the list */
for (; i < playlist.length; i++) {
- ri = g_rand_int_range(g_rand, 1, playlist.length);
+ ri = g_rand_int_range(g_rand, i, playlist.length);
swapSongs(i, ri);
}