RSS/Atom feed Twitter
Site is read-only, email is disabled

script-fu "rand" function

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

script-fu "rand" function Catherine Jones 21 Mar 23:10
  script-fu "rand" function Kevin Cozens 22 Mar 03:48
script-fu "rand" function Catherine Jones 22 Mar 08:36
Catherine Jones
2009-03-21 23:10:30 UTC (about 15 years ago)

script-fu "rand" function

Hello,

When I use the "rand" function in a script-fu script that I run non-interactively from the command line, I get the exact same result every time. In other words, the command

gimp -i -b '( ...)' -b '(gimp-quit 0)'

always does the same thing (assuming the same variable inputs).

This is not the behavior I want. I'd like to be able to re-seed the random number generator so as to get randomly different results. Is this possible with script-fu? Thanks... Catherine

Kevin Cozens
2009-03-22 03:48:48 UTC (about 15 years ago)

script-fu "rand" function

Catherine Jones wrote:

gimp -i -b '( ...)' -b '(gimp-quit 0)'

always does the same thing (assuming the same variable inputs).

Of course it would. You are starting a fresh copy of GIMP each time. If you want to change the seed each time you start GIMP, add '(srand (realtime))' before you call '(rand)'.

Catherine Jones
2009-03-22 08:36:21 UTC (about 15 years ago)

script-fu "rand" function

Kevin Cozens wrote:

If you want to change the seed each time you start GIMP, add '(srand (realtime))' before you call '(rand)'.

Thanks. That solved my problem. -- Catherine