Create Random Raster (Data Management)

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.

Parameters

LabelExplanationData Type
Output Location

The folder or geodatabase where the output raster dataset will be stored.

Workspace
Raster Dataset Name with Extension

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:

  • .tif—TIFF raster
  • .img—ERDAS IMAGINE raster
  • .crf—CRF raster
  • No extension—Esri Grid
String
Distribution
(Optional)

Specifies the random value distribution method to use.

Each type has one or two settings to control the distribution.

  • Uniform—A uniform distribution with the defined range between the Minimum and Maximum values. The default values are 0.0 for Minimum and 1.0 for Maximum. This is the default.
  • Integer—An integer distribution with the defined range between the Minimum and Maximum values. The default values are 1 for Minimum and 10 for Maximum.
  • Normal—A normal distribution with defined Mean and Standard Deviation values. The default values are 0.0 for Mean and 1.0 for Standard Deviation.
  • Exponential—An exponential distribution with a defined Mean value. The default value is 1.0.
  • Poisson-—A Poisson distribution with a defined Mean value. The default value is 1.0.
  • Gamma—A gamma distribution with defined Alpha and Beta values. The default values are 1.0 for Alpha and 1.0 for Beta.
  • Binomial—A binomial distribution with defined N and Probability values. The default values are 10 for N and 0.5 for Probability.
  • Geometric—A geometric distribution with a defined Probability value. The default value is 0.5.
  • Negative Binomial—A Pascal distribution with defined r and Probability values. The default values are 10.0 for r and 0.5 for Probability.

To edit the default value, click the value in the table and type the new value.

String
Output extent
(Optional)

The extent of the output raster dataset.

  • Current Display Extent Map View—The extent will be based on the active map or scene. This option is only available when there is an active map.
  • Extent of a Layer Layer—The extent will be based on an active map layer. Use the drop-down list to choose an available layer or use the Extent of data in all layers option to get the combined extent of all active map layers, excluding the basemap. This option is only available when there is an active map with layers.
  • Browse Browse—The extent will be based on an existing dataset.
  • Reset Extent Reset—The extent will be reset to the default value.
  • Manually entered coordinates—The coordinates must be numeric values and in the active map's coordinate system.

    The map may be using different display units

Extent
Cellsize
(Optional)

The spatial resolution of the output raster dataset.

Double
Build raster attribute table
(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.

  • Checked—A raster attribute table will be unconditionally built for integer output rasters. This is the default.
  • Unchecked—A raster attribute table will not be built for integer output rasters if the number of unique values is greater than or equal to 65535. If the number of unique values is less than 65535, a raster attribute table will be built.
Boolean

Derived Output

LabelExplanationData Type
Output raster dataset

The output raster dataset.

Raster Dataset

arcpy.management.CreateRandomRaster(out_path, out_name, {distribution}, {raster_extent}, {cellsize}, {build_rat})
NameExplanationData 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:

  • .tif—TIFF raster
  • .img—ERDAS IMAGINE raster
  • .crf—CRF raster
  • No extension—Esri Grid
String
distribution
(Optional)

Specifies the random value distribution method to use.

Each type has one or two settings to control the distribution.

  • UNIFORM {Minimum}, {Maximum}—A uniform distribution with the defined range. The default values are 0.0 for {Minimum} and 1.0 for {Maximum}. Both values are of type double.
  • INTEGER {Minimum}, {Maximum}—An integer distribution with the defined range. The default values are 1 for {Minimum} and 10 for {Maximum}. Both values are of type long.
  • NORMAL {Mean}, {Standard Deviation}—A normal distribution with defined {Mean} and {Standard Deviation} values. The default values are 0.0 for {Mean} and 1.0 for {Standard Deviation}. Both values are of type double.
  • EXPONENTIAL {Mean}—An exponential distribution with a defined {Mean} value. The default value is 1.0. The value is of type double.
  • POISSON {Mean}—A Poisson distribution with a defined {Mean} value. The default value is 1.0. The value is of type double.
  • GAMMA {Alpha}, {Beta}—A gamma distribution with defined {Alpha} and {Beta} values. The default values are 1.0 for {Alpha} and 1.0 for {Beta}. Both values are of type double.
  • BINOMIAL {N}, {Probability}—A binomial distribution with defined {N} and {Probability} values. The {N} value is of type long with a default of 10. The {Probability} value is of type double with a default of 0.5.
  • GEOMETRIC {Probability}—A geometric distribution with a defined {Probability} value. The default value is 0.5. The value is of type double.
  • NEGATIVE BINOMIAL {r}, {Probability}—A Pascal distribution with defined {r} and {Probability} values. The {r} value is of type double with a default of 10.0. The {Probability} value is of type double with a default of 0.5.
String
raster_extent
(Optional)

The extent of the output raster dataset.

  • MAXOF—The maximum extent of all inputs will be used.
  • MINOF—The minimum area common to all inputs will be used.
  • DISPLAY—The extent is equal to the visible display.
  • Layer name—The extent of the specified layer will be used.
  • Extent object—The extent of the specified object will be used.
  • Space delimited string of coordinates—The extent of the specified string will be used. Coordinates are expressed in the order of x-min, y-min, x-max, y-max.
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.

  • BUILDA raster attribute table will be unconditionally built for integer output rasters. This is the default.
  • DO_NOT_BUILDA raster attribute table will not be built for integer output rasters if the number of unique values is greater than or equal to 65535. If the number of unique values is less than 65535, a raster attribute table will be built.
Boolean

Derived Output

NameExplanationData Type
out_raster_dataset

The output raster dataset.

Raster Dataset

Code sample

CreateRandomRaster example 1 (Python window)

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)
CreateRandomRaster example 2 (stand-alone script)

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)

Licensing information

  • Basic: Requires 3D Analyst or Spatial Analyst
  • Standard: Requires 3D Analyst or Spatial Analyst
  • Advanced: Yes

Related topics