Available with Advanced license.
Summary
Creates a raster dataset of random values with a distribution you define.
Usage
You can save your output to Esri Grid, CRF, IMG, TIFF, or any geodatabase raster dataset.
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. Review the Random Number Generator environment to determine the one to use. 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 the distribution to use is determined by the end use of the raster. If the random raster is to model a 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 typically 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.
On the tool dialog box, the values of the Output extent parameter are in the coordinate system of the map. During tool execution, the extent is projected to the Output Coordinate System if it is specified in the environment settings.
Syntax
arcpy.management.CreateRandomRaster(out_path, out_name, {distribution}, {raster_extent}, {cellsize}, {build_rat})
Parameter | Explanation | Data Type |
out_path | The folder or geodatabase where the output raster dataset will be stored. | Workspace |
out_name | The name and format of the raster dataset you are creating. To store the output as a raster dataset in a geodatabase, do not add a file extension to the raster dataset name. For file-based rasters, use the appropriate extension to specify the format to create as follows:
| String |
distribution (Optional) | Specifies the random value distribution method to use. Each type has one or two settings to control the distribution.
| String |
raster_extent (Optional) | The extent of the output raster dataset.
| Extent |
cellsize (Optional) | The spatial resolution of the output raster dataset. | Double |
build_rat (Optional) | Specifies whether the tool will unconditionally build a raster attribute table for the output raster in which the selected distribution results in an integer output raster. This parameter has no effect if the output raster is floating point.
| Boolean |
Derived Output
Name | Explanation | Data Type |
out_raster_dataset | The output raster dataset. | Raster Dataset |
Code sample
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)
Environments
Licensing information
- Basic: Requires 3D Analyst or Spatial Analyst
- Standard: Requires 3D Analyst or Spatial Analyst
- Advanced: Yes