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

Glynn Clements glynn at gclements.plus.com
Sat Jul 5 15:34:59 PDT 2014


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(...)

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list