[GRASS-dev] [GRASS GIS] #2272: Improve consistency in random generator usage

GRASS GIS trac at osgeo.org
Thu Nov 27 09:24:48 PST 2014


#2272: Improve  consistency in random generator usage
-------------------------+--------------------------------------------------
 Reporter:  neteler      |       Owner:  grass-dev@…              
     Type:  defect       |      Status:  new                      
 Priority:  major        |   Milestone:  7.0.0                    
Component:  Default      |     Version:  svn-releasebranch70      
 Keywords:  random       |    Platform:  Unspecified              
      Cpu:  Unspecified  |  
-------------------------+--------------------------------------------------

Comment(by glynn):

 Replying to [comment:6 neteler]:
 > By chance I found
 >
 > raster/simwe/simlib/random.c
 >
 > /*      uniform random number generator (combined type) */
 >
 > Should that be replaced as well (how)?

 ulec() can be replaced by G_drand48().

 seedg() isn't used.

 seeds() is always called with fixed values (12345 and 67891). Either call
 G_srand48() with a fixed value (if repeatability is important), or call
 G_srand48_auto() for a non-deterministic seed (if it isn't), or add a
 seed= option to the modules.

 FWIW, it seems possible for ulec() to return values slightly greater than
 1:

 {{{
     ret_val = (double)iz *4.656613e-10;

     return ret_val;
 }}}

 (2^31^-1) * 4.656613e-10 = 1.0000000267907612

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2272#comment:7>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list