<div dir="ltr">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).<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 3, 2014 at 8:55 AM, Paulo van Breugel <span dir="ltr"><<a href="mailto:p.vanbreugel@gmail.com" target="_blank">p.vanbreugel@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000099"><div class="">
<br>
<div>On 03-07-14 03:43, Vaclav Petras wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Jul 2, 2014 at 8:15 PM, Glynn
Clements <span dir="ltr"><<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>> Shouldn't the seed not be generated on
e.g, OS time,<br>
> which would ensure that each run would give a
different result?<br>
<br>
</div>
No. The reason is to provide reproducibility. Anyone
running the same<br>
command with the same data should obtain the same result.<br>
</blockquote>
</div>
</div>
</div>
</blockquote></div>
It is certainly be good to be able to reproduce commands. However, I
think in most (statistical) software the default / expected
behaviour is to have a new automatically generated seed at each run.
In R for example, if you have to explicitly specify the seed using
the function set.seed(). I would think therefore what most users
will expect a similar behaviour in GRASS. It would certainly be my
personal preference to have the option to set the seed explicitly if
you want reproducibility, but have it generated automatically
otherwise. But that is just a personal preference.<div class=""><br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
</blockquote>
<div>Does the reproducibility go behind one operating
system, compiler or library? I don't think that the first
random number is specified by the C language standard. If
the results would be really reproducible it would be good
for testing framework but I'm afraid that they are not
(with my limited knowledge about the topic).<br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If you want a different result each time, set
GRASS_RND_SEED to a<br>
different value each time, e.g.<br>
<br>
GRASS_RND_SEED=`date +%N` r.mapcalc "a =
rand(0,100)"<br>
<br>
[%N is the nanoseconds portion of the current time; this
is a GNU<br>
extension.]<br>
</blockquote>
</div>
</div>
</div>
</blockquote></div>
Perhaps this can be explained like this in the manual page? A far
better option would be to provide this as a normal parameter so it
can be set from the gui interface or command line like any other
variable.<div class=""><br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div><br>
</div>
<div>I've heard that this is not enough on powerful
computers/clusters, that you have to use also PID because
nanoseconds might be the same (I think I rememberer that
it was nanoseconds not seconds).<br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><br>
> On a related note, it would be nice to be able to
set the seed (I think<br>
> there has been such a request before, but not sure
about the answer at that<br>
> time).<br>
<br>
</div>
GRASS_RND_SEED was the answer.</blockquote>
</div>
<br>
</div>
<div class="gmail_extra">I think there should be some
possibility of randomization (auto-setting of seed) build-in
the modules providing random(ized) results. Perhaps a flag
which would turn it on. It can be also an option which would
behave like GRASS_RND_SEED but would have one special value
for auto-generating the seed. (GRASS_RND_SEED if present would
override this option.) With the default value of the option we
should ask a question what is actually the expected behavior
of the module giving random results.<br>
</div>
</div>
</blockquote></div>
Yes, that would be great. As for the default value, see my earlier
argument.<div class=""><br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<br>
This would provide a nicer interface in Python, standard
interface in command line, and possibility to set it in the
GUI (which means possibility to set it for users which don't
use command line.) Moreover, it would provide all users with
the way of setting the random seen in the manner which we
consider the best according to our knowledge.<br>
</div>
</div>
</blockquote></div>
Agree. The way to set the seed now may not be understood by
everybody and with all the work going into streamlining the GUI,
this kind of fairly important options should also be available
through the GUI<br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_extra">
<br>
</div>
<div class="gmail_extra">Vaclav<br>
</div>
</div>
</blockquote>
<br>
</div>
</blockquote></div><br></div>