GRASS logo

Note: A new GRASS GIS stable version has been released: GRASS GIS 7.4, available here.
Updated manual page: here


r.random.cells - Generates random cell values with spatial dependence.


raster, sampling, random, autocorrelation


r.random.cells --help
r.random.cells output=name distance=float [seed=integer] [--overwrite] [--help] [--verbose] [--quiet] [--ui]


Allow output files to overwrite existing files
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


output=name [required]
Name for output raster map
distance=float [required]
Maximum distance of spatial correlation (value >= 0.0)
Random seed (SEED_MIN >= value >= SEED_MAX) (default [random])

Table of contents


r.random.cells generates a random sets of raster cells that are at least distance apart. The cells are numbered from 1 to the numbers of cells generated, all other cells are 0 (zero). Random cells will not be generated in areas masked off.

Detailed parameter description

Random cells. Each random cell has a unique non-zero cell value ranging from 1 to the number of cells generated. The heuristic for this algorithm is to randomly pick cells until there are no cells outside of the chosen cell's buffer of radius distance.
Determines the minimum distance the centers of the random cells will be apart.
Specifies the random seed that r.random.cells will use to generate the cells. If the random seed is not given, r.random.cells will get a seed from the process ID number.


The original purpose for this program was to generate independent random samples of cells in a study area. The distance value is the amount of spatial autocorrelation for the map being studied.


North Carolina sample dataset example:
g.region n=228500 s=215000 w=630000 e=645000 res=100 -p
r.random.cells output=random_500m distance=500

# optionally set 0 to NULL (masked off areas)
r.null random_500m setnull=0


Random Field Software for GRASS GIS by Chuck Ehlschlaeger

As part of my dissertation, I put together several programs that help GRASS (4.1 and beyond) develop uncertainty models of spatial data. I hope you find it useful and dependable. The following papers might clarify their use:


r.random.surface, r.random


Charles Ehlschlaeger; National Center for Geographic Information and Analysis, University of California, Santa Barbara.

Last changed: $Date: 2015-04-21 07:00:05 -0700 (Tue, 21 Apr 2015) $


Available at: r.random.cells source code (history)

Note: A new GRASS GIS stable version has been released: GRASS GIS 7.4, available here.
Updated manual page: here

Main index | Raster index | Topics index | Keywords index | Full index

© 2003-2018 GRASS Development Team, GRASS GIS 7.0.7svn Reference Manual