Hi all,

I recently changed all occurrences of rand() and friends to use
g_rand* from the glib 2.0 interface. And in doing so, some of the
flaws of the gimp random seed widget annoyed me. I have some
suggestions for changing it, which I thopught I'd run past the
list before I commit the changes (these are, for the most part,
minor changes which are already done on my machine).

The gimp_random_seed_new() function currently creates a
spinbutton for the seed, and a togglebutton for whether a Time
seed should be used. With the change over to g_rand* () the
default seeding (which is from /dev/urandom by default, and time
if that fails) is much better, so Time os probably no longer
appropriate as a label. But that's superficial. 

The real change would be to do away with the toggle, replace the 
toggle button with a normal button, and set a random seed in the 
spin-box when the button is pressed. For this, I've been using 
the global PRNG (g_random_int) rather than setting up what would be 
a short-lived GRand * object, but again that would be a trivial 
change. 

After that the only thing left to do is "intelligent" default
seeding. Do we seed with 0 as the default, and use the same seed
as the last time if "run with last vals" is used for a plug-in?
Should the gimp_random_seed_new() function set a random seed when
called?  Or do we seed with a random number to start? Currently 
the setting of an initial seed is entirely the plug-ins
responsibility. I propose we leave it that way. The "run with
last vals" should use, imho, the same seed value. This can, of
course, be modified from plug-in to plug-in, but I think it's a
sane behaviour. 

Also, once the behaviour is decided, we should use the random
seed widget across more plug-ins. Several plug-ins currently do
their own thing in this respect, and there's no real need for it.
So there you go - nothing too contentious, but since it's an
interface change, it was suggested I send in a mail. My opinion
is that a random seed box, when used, should set a seed.

Cheers,
Dave.

-- 
       David Neary,
    Marseille, France
  E-Mail: [EMAIL PROTECTED]
_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer

Reply via email to