[GRASS-dev] using rand(x,y) in r.mapcalc (grass7)
kratochanna at gmail.com
Tue Jul 22 19:07:29 PDT 2014
On Tue, Jul 22, 2014 at 8:14 PM, Glynn Clements <glynn at gclements.plus.com>
> Glynn Clements wrote:
> > I'm inclined to add both an option (to specify a seed, replacing the
> > environment variable) and a flag (to seed from the system clock or
> > whatever), and having the PRNG generate a fatal error if neither of
> > those are used.
> This is now done.
> r61350 adds the lrand48/mrand48/drand48 equivalents to lib/gis. Brief
> testing suggests that the results are identical to those generated by
> GNU libc (which should be identical to any other POSIX implementation).
> r61352 changes it to generate a fatal error if used prior to seeding.
> r61353 changes r.mapcalc so that seeding is performed via seed= or -s.
> The seed (whether specified by seed= or generated for -s) is added to
> the history (for r.mapcalc; r3.mapcalc's create_history() function is
> a stub; do 3D rasters have history?)
> Note that GRASS_RND_SEED is no longer supported. That was a hack from
> the time before r.mapcalc used G_parser().
> As I write this, it has occurred to me that the behaviour of rand()
> may be non-deterministic in the presence of certain forms of
> parallelism, e.g. multiple occurences of rand() in the expression(s)
> in conjunction with pthreads. Ultimately we may need to expand the
> PRNG to support explicit state (as per erand48, nrand48 and jrand48).
I added the support for -s and seed to the r.mapcalc gui in 61354. Testing
is very welcome.
I wonder if there are any modules in core or addons which need to be
> Glynn Clements <glynn at gclements.plus.com>
> grass-dev mailing list
> grass-dev at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the grass-dev