[xiph-commits] r11553 - icecast/trunk/ices0/src/playlist

brendan at svn.xiph.org brendan at svn.xiph.org
Fri Jun 9 15:59:42 PDT 2006


Author: brendan
Date: 2006-06-09 15:59:40 -0700 (Fri, 09 Jun 2006)
New Revision: 11553

Modified:
   icecast/trunk/ices0/src/playlist/rand.c
Log:
Only reseed once, not on every reshuffle. Should fix the reported
problem that ices keeps playing the same songs in the same order when
the playlist is edited. Noted by Matt Francis.


Modified: icecast/trunk/ices0/src/playlist/rand.c
===================================================================
--- icecast/trunk/ices0/src/playlist/rand.c	2006-06-09 22:55:50 UTC (rev 11552)
+++ icecast/trunk/ices0/src/playlist/rand.c	2006-06-09 22:59:40 UTC (rev 11553)
@@ -64,11 +64,16 @@
 static void 
 scramble (FILE *fp, FILE *out)
 {
+  static int seeded = 0;
+
   char *line_storage = NULL, **table = NULL;
   struct ll *llist = NULL, *ptr = NULL;
   int size = 0, n = 0, x = 0;
 
-  srand (ices_util_get_random ());
+  if (!seeded) {
+    srand (ices_util_get_random ());
+    seeded = 1;
+  }
 
   llist = malloc (sizeof (struct ll));
   llist->data = NULL;



More information about the commits mailing list