[GRASS-dev] r.mapcalc addition

Glynn Clements glynn at gclements.plus.com
Mon Oct 23 11:28:12 EDT 2006

Joel Pitt wrote:

> It'd be great if someone could commit the attached addition to r.mapcalc
> It basically allows one to specify the seed for random number
> generation by adding a new function "erand(a,b,s)" which takes a and b
> as the lower and upper limit, and s is a seed that is used to initiate
> the pseudo random number generator.
> This is useful in modelling and simulation so that particular
> replicates can be rerun exactly.
> If it needs any extra work let me know and I'll make the changes.

I consider this to be the wrong approach. At a minimum, setting the
seed should be decoupled from the generation of random numbers;
there's no reason to have what is essentially another copy of

Also, it's debatable whether an r.mapcalc function is the correct
mechanism for setting an operating parameter. An environment variable
might be more suitable.

Finally, even if f_erand() was the correct interface, having it call
f_rand() once the seed has been set is preferable to including a clone
of f_rand() in the body of f_erand().

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list