On 21-07-14 19:01, Markus Neteler wrote:
On Sun, Jul 6, 2014 at 12:25 AM, Glynn Clements
<gl...@gclements.plus.com> wrote:
Glynn Clements <gl...@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.
And not only the R community I am sure. In all statistical packages I have ever worked with one can see the same behaviour, a random number is random (i.e., each time a different seed), unless the seed is explicitly defined by the user. And it seems to be the default behaviour by python/numpy:

>>> import numpy as np
>>> np.random.random()
0.8351426142559701
>>> np.random.random()
0.4813823441998394
>>> np.random.random()
0.7279314267025369

Just to avoid this:
https://xkcd.com/221/

Markus

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to