<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 22, 2014 at 10:07 PM, Anna Petrášová <span dir="ltr"><<a href="mailto:kratochanna@gmail.com" target="_blank">kratochanna@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 dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="">On Tue, Jul 22, 2014 at 8:14 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-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><br>
Glynn Clements wrote:<br>
<br>
> I'm inclined to add both an option (to specify a seed, replacing the<br>
> environment variable) and a flag (to seed from the system clock or<br>
> whatever), and having the PRNG generate a fatal error if neither of<br>
> those are used.<br>
<br>
</div>This is now done.<br>
<br>
r61350 adds the lrand48/mrand48/drand48 equivalents to lib/gis. Brief<br>
testing suggests that the results are identical to those generated by<br>
GNU libc (which should be identical to any other POSIX implementation).<br>
<br>
r61352 changes it to generate a fatal error if used prior to seeding.<br>
<br>
r61353 changes r.mapcalc so that seeding is performed via seed= or -s.<br>
The seed (whether specified by seed= or generated for -s) is added to<br>
the history (for r.mapcalc; r3.mapcalc's create_history() function is<br>
a stub; do 3D rasters have history?)<br>
<br>
Note that GRASS_RND_SEED is no longer supported. That was a hack from<br>
the time before r.mapcalc used G_parser().<br>
<br>
As I write this, it has occurred to me that the behaviour of rand()<br>
may be non-deterministic in the presence of certain forms of<br>
parallelism, e.g. multiple occurences of rand() in the expression(s)<br>
in conjunction with pthreads. Ultimately we may need to expand the<br>
PRNG to support explicit state (as per erand48, nrand48 and jrand48).<br></blockquote><div><br></div></div><div>I added the support for -s and seed to the r.mapcalc gui in 61354. Testing is very welcome.</div><div><br></div>
<div>
I wonder if there are any modules in core or addons which need to be updated.</div></div></div></div></blockquote><div><br></div><div>For example all TGRASS tests are affected.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="HOEnZb"><font color="#888888"><div><br></div><div>Anna </div></font></span><div class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div><br>
--<br>
Glynn Clements <<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>><br>
_______________________________________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>
</div></div></blockquote></div></div><br></div></div>
</blockquote></div><br></div></div>