implement random playback
[uwplayer.git] / application / playlist.c
index 80d335b..1b31180 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "playlist.h"
 
+#include <stdlib.h>
+
 #include "player.h"
 #include "utils.h"
 
@@ -44,6 +46,8 @@ void PlayListPlayNext(MainWindow *win, bool force) {
         if(force) {
             current++;
         }
+    } else if(win->playlist.random) {
+        current = random() % len;
     } else if(current < len) {
         current++;
     } else if(win->playlist.autoplayFolder) {