« Return to Thread: A simple (?) question...

Re: A simple (?) question...

by Torsten Neuer :: Rate this Message:

Reply to Author | View in Thread

Hi David,

> >  Since I haven't been able to find a function within the libraries that I
> > could use as a starting point (and of course I do not want to re-invent
> > the wheel), my question is, if there is such a function that would
> > provide an identical value for any identical image - or would I have to
> > write a kind of pre-filter in order to generate that value ?
>
> What you are talking about is a hash function. There is a string
> hasher in GLib that should do what you want.

Quite so, yes - thank you, I'll try that out.

> However, be aware,
> the criteria 'a random number seed that is unique for every image that
> is going to be processed,' cannot be fulfilled in an absolute way.
> With a hash value of 32bits, that's > 4 billion possible hashes.
> Practically speaking, you are likely to encounter a hash collision*
> unless the amount of images in the set you're processing gets very
> large, you should be aware that it is always possible though.

I am aware of that. The point is, that the function is a random but -
according to it's documentation should behave identically for identical
images.  The idea behind this is, that you should be able to recreate the
same effect on the same image - even if there is such a thing called random.

The cheapest possible solution to that would be to use a constant as the
random number seed.  This, however, would make the random function very
predictable, which I feel is horribly wrong - so I'd rather go with a hash
which may collide from time to time, yet still will be a good enough seed.


  Torsten


_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

signature.asc (196 bytes) Download Attachment

 « Return to Thread: A simple (?) question...