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

Markus Neteler neteler at osgeo.org
Mon Jul 21 10:01:30 PDT 2014


On Sun, Jul 6, 2014 at 12:25 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
>> Glynn Clements <glynn at gclements.plus.com> wrote:
...
> In ticket #2272, I attached a portable implementation of lrand48(). If
> desired, we could add this to libgis and use that in preference to any
> implementation-specific PRNG.

This would be excellent.

>>> If you want a different result each time, set GRASS_RND_SEED to a
>>> different value each time, e.g.

IMHO this is not intuitive at all. I would suggest to invert the
behaviour for GRASS 7:
- per default generate random numbers which differ,
- if the user needs reproducability, then have a env var to enable that.

> The main thing is that I believe that
> reproducibility should be the default.

I humbly disagree. This is not what the user expects. It is also the
opposite of how for example R behaves:

R
> runif(1)
[1] 0.5624295
> runif(1)
[1] 0.1683853

http://en.wikibooks.org/wiki/R_Programming/Random_Number_Generation#Seed
" If you want to perform an exact replication of your program, you
have to specify the seed using the function set.seed()."

> If people have to take explicit
> action to introduce randomness,

The problem is that most will not even realize the current behaviour of rand().

> they're more likely to consider the
> issues involved. If randomised seeds are the default, the lack of
> reproducibility may not be considered until it is too late.

The R community (and some users here) think the opposite... when you
ask for rand() then you expect a random number. Just to avoid this:
https://xkcd.com/221/

Markus


More information about the grass-dev mailing list