Commit f8640490 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Only set random seed once

Fixes non-random behaviour when randomizing file lists several times per
second.

Closes #349
parent e522c4ea
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -360,7 +360,6 @@ gib_list_randomize(gib_list * list)
   {
      farray[i] = f;
   }
   srand(getpid() * time(NULL) % ((unsigned int) -1));
   for (i = 0; i < len - 1; i++)
   {
      r = i + rand() / (RAND_MAX / (len - i) + 1 );
+0 −3
Original line number Diff line number Diff line
@@ -133,9 +133,6 @@ void init_x_and_imlib(void)

	imlib_set_cache_size(opt.cache_size * 1024 * 1024);

	/* Initialise random numbers */
	srand(getpid() * time(NULL) % ((unsigned int) -1));

	return;
}

+2 −0
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ int main(int argc, char **argv)
{
	atexit(feh_clean_exit);

	srand(getpid() * time(NULL) % ((unsigned int) -1));

	setup_signal_handlers();
	init_parse_options(argc, argv);