[GRASS-dev] r.mapcalc addition

Hamish hamish_nospam at yahoo.com
Mon Oct 23 22:02:00 EDT 2006

Glynn Clements wrote:
> > what if r.mapcalc's rand(a,b) fn had an optional third argument? ie
> > the seed. rand(a,b) would work as it currently does, but
> > rand(a,b,seed) would be available if you wanted it.
> That could be problematic if you have more than one call to rand(). We
> don't actually specify the evaluation order (GRASS functions don't
> have side effects).
> If r.mapcalc used G_parser(), a seed=... option would be the obvious
> choice, but it doesn't, and that can't easily be changed. An
> environment variable is probably the next best thing. For scripts,
> setting an environment variable is typically easier than substituting
> into an r.mapcalc expression (particularly if you are reading the
> expression from a file).

if you have more than one call to rand() and both are seeded with the
same value (GRASS_RND_SEED or whatever), won't you get the same "random"
number both times?

should the seed be read on startup in main.c, not xrand.c ..?


More information about the grass-dev mailing list