use a single random number generator for the lifetime of the plug-in.

2005-09-28  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/gqbist.c: use a single random number generator
	for the lifetime of the plug-in. Fixes bug #317355.
This commit is contained in:
Sven Neumann 2005-09-28 14:29:48 +00:00 committed by Sven Neumann
parent 81fd5e2894
commit 11b15cf106
2 changed files with 12 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2005-09-28 Sven Neumann <sven@gimp.org>
* plug-ins/common/gqbist.c: use a single random number generator
for the lifetime of the plug-in. Fixes bug #317355.
2005-09-28 Sven Neumann <sven@gimp.org>
* docs/Makefile.am

View File

@ -108,7 +108,9 @@ static void dialog_update_previews (GtkWidget *widget,
static void dialog_select_preview (GtkWidget *widget,
ExpInfo *n_info);
static QbistInfo qbist_info;
static QbistInfo qbist_info;
static GRand *gr = NULL;
/** qbist functions *********************************************************/
@ -116,9 +118,6 @@ static void
create_info (ExpInfo *info)
{
gint k;
GRand *gr;
gr = g_rand_new();
for (k = 0; k < MAX_TRANSFORMS; k++)
{
@ -127,8 +126,6 @@ create_info (ExpInfo *info)
info->control[k] = g_rand_int_range (gr, 0, NUM_REGISTERS);
info->dest[k] = g_rand_int_range (gr, 0, NUM_REGISTERS);
}
g_rand_free(gr);
}
static void
@ -136,9 +133,7 @@ modify_info (ExpInfo *o_info,
ExpInfo *n_info)
{
gint k, n;
GRand *gr;
gr = g_rand_new ();
*n_info = *o_info;
n = g_rand_int_range (gr, 0, MAX_TRANSFORMS);
for (k = 0; k < n; k++)
@ -166,7 +161,6 @@ modify_info (ExpInfo *o_info,
break;
}
}
g_rand_free (gr);
}
/*
@ -462,6 +456,8 @@ run (const gchar *name,
if (status == GIMP_PDB_SUCCESS)
{
gr = g_rand_new ();
memset (&qbist_info, 0, sizeof (qbist_info));
create_info (&qbist_info.info);
qbist_info.oversampling = 4;
@ -542,6 +538,8 @@ run (const gchar *name,
gimp_displays_flush ();
}
g_rand_free (gr);
}
values[0].type = GIMP_PDB_STATUS;