[GRASS-dev] using rand(x,y) in r.mapcalc (grass7)

Paulo van Breugel p.vanbreugel at gmail.com
Sat Jul 5 15:39:41 PDT 2014

On Sun, Jul 6, 2014 at 12:34 AM, Glynn Clements <glynn at gclements.plus.com>

> Paulo van Breugel wrote:
> > Just a quick additional question, how to set this GRASS_RND_SEED from
> > within a python script (I want to add the option to set the seed with a
> > seed parameter in my script, as suggested in the previous email).
> You can modify os.environ prior to calling it, e.g.
>         import time
>         import grass.script as grass
>         ...
>         t = int(time.time() * 1e9) % (2**31)
>         os.environ['GRASS_RND_SEED'] = '%d' % t
>         grass.mapcalc(...)
Hi, thanks.. I found out the solution after a bit of diving into the
documentation. I btw still think the default should be to have a random
seed as I think that is what most people would expect (I did, but after
running a function for a day and night, I found out I was wrong). But
anyway, it ultimately comes down to preference, so most important I think
is if the user has a clear choice available in both the gui and on the
command line. If that could be implemented, either way, that would be great.

> --
> Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140706/f0ca1368/attachment.html>

More information about the grass-dev mailing list