I just learned something new today. rand() under SunOS 4.1.x
has a range of to (2^31)-1, but rand() in Solaris 2.3 has a range of
0 to (2^15)-1. A quick check of src/libes shows that rand()
is used, but I'm not sure how the differences in the maximum
value would affect the code here, and I don't know how many
other places it's used in GRASS source code.
Should gis.h include stdlib.h? As far as I can tell, this is
not included anywhere. In 2.3, it defines RAND_MAX, but
in 4.1.x it doesn't. So, this would allow something like:
#ifndef RAND_MAX
#define RAND_MAX (pow(2.0,31.0)-1)
#endif
#define RANDOM(lo,hi) ((double)rand()/RAND_MAX*(hi-lo)+lo)
Comments?
Is rand() different on other OSs?
--Darrell