Michael Shapiro shapiro at zorro.cecer.army.mil
Wed Aug 4 21:10:17 EDT 1993

In <9307221717.AA06419 at pasture.ecn.purdue.edu> mccauley at ecn.purdue.edu (Darrell McCauley) writes:

>I need to generate random points. It's
>important that the points simulate a
>homogeneous Poisson process (close as
>possible). The inadequacies of rand() have
>been well documented, so my feeling is that
>r.random may also be lacking (since it uses
>rand()).  Has anyone tested this program and
>documented its performance (Monte Carlo
>methods, perhaps using the outline given on
>pp. 635-6 in Cressie's _Statistics for
>Spatial Data_)? If so, can you provide
>this documentation?

The r.random code calls rand() but it does this
more or less as
	rand() << 16 + rand()
or something like that. This was to get around the
fact that rand() only generated numbers from 1-2^16
(or at least it used to). r.random has NOT been
revisited since this time.

>Does anyone have any GRASS alternatives?
>Does anyone have a need for alternatives?

>Not only do I need to generate random
>points, but I also need to use them to
>randomly select sites, perhaps using a
>nearest neighbor approach. This is for a
>k-fold cross validation of some
>interpolation methods.  Would anyone else
>have a need for a GRASS program that does

>I ask because if I get one or two others
>that say "yes, I need that," then the
>probability is pretty high that I'll package
>up another GRASS program or two (for some
>reason I'm in a programming mood %-).

>To that end, is there any random number
>generator already contained in GRASS code

No, sorry. You could look at drand48() which
generates numbers between 0.0 and 1.0. Read
Number Recipes in C for a discussion about
random number generators and ways to generate
various kinds of distributions.

Michael Shapiro               shapiro at zorro.cecer.army.mil
U.S. Army CERL                (217) 373-7277
P.O. Box 9005 
Champaign, Ill. 61826-9005

More information about the grass-user mailing list