Create Random Raster (Data Management)
Creates a random raster dataset based on a user-specified distribution and extent.
The values assigned to each cell in the output raster are derived from the random number generator and the selected distribution type. There are several random number generators available for use, and the one you wish to use is identified in the Environments Settings, in the Random Numbers section. The random number generator starts a stream of random numbers based on the generator type and a seed value. These numbers are randomly determined and the values fall between 0 and 1. Each value is independent of the other values.
Multiple distribution types are available for the random number generators when assigning (or transforming) the values in the output raster. The distributions generally produce different results, and which distribution to select is determined by the end use of the raster. If the random raster is to model some natural phenomenon, the distribution selected should be the best representation of the process of the phenomenon.
For a description of the distributions and how they are generally used, see Distributions for assigning random values.
The Uniform, Integer, Normal, and Exponential distributions' processing times are independent of their arguments, while the Poisson, Gamma, Binomial, Geometric, and Pascal distributions' processing times can vary considerably when arguments are changed.
A default value is calculated for the cell size parameter if no value is provided. This value is based on the size of the extent.
The location of the output raster dataset.
The name of the raster dataset to be created.
When not saving to a geodatabase, specify .tif for a TIFF file format, .img for an ERDAS IMAGINE file format, or no extension for a GRID file format.
The distribution of random values desired is as follows:
The spatial extent of the random raster dataset.
The cell size of the new random raster dataset.
This sample creates an output raster of random values with a normal distribution at the defined extent and cell size
import arcpy arcpy.CreateRandomRaster_management("c:/output", "randrast", "NORMAL 3.0", "0 0 500 500", 50)
This sample creates an output raster of random values with a Poisson distribution at the defined extent and cell size.
# Name: CreateRandomRaster_Ex_02.py # Description: Creates a random raster dataset based on a # user-specified distribution and extent. # Requirements: None # Import system modules import arcpy # Set local variables outPath = "c:/output" outFile = "randrast02" distribution = "POISSON 6.4" outExtent = "250 250 750 750" cellSize = 25 # Execute CreateRandomRaster arcpy.CreateRandomRaster_management(outPath, outFile, distribution, outExtent, cellSize)