Available with Advanced license.

## Summary

Create a raster dataset of random values with a distribution you can define.

## Usage

You can save your output to Esri Grid, 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 for use, and the one you want to use is identified in the Environment setting in Random numbers. 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.

## Syntax

CreateRandomRaster_management (out_path, out_name, {distribution}, {raster_extent}, {cellsize})

Parameter | Explanation | Data Type |

out_path | Select a folder or geodatabase to store the raster dataset. | Workspace |

out_name | Specify a name and, where necessary, extension for the output raster dataset. When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset. To store the output as an Esri Grid raster or a raster dataset in a geodatabase, no file extension should be added to the name of the raster dataset. To store the raster dataset in one of the available file raster formats, specify a tif extension to output a TIFF raster, or .img for an ERDAS IMAGINE raster. When storing your raster dataset to a TIFF file, or a geodatabase raster, you can specify a compression type and compression quality. | String |

distribution (Optional) | Specify the random value distribution method to use. - 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 a defined {Mean} and {Standard Deviation}. 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}. The default value is 1.0. The value is of type double.
- POISSON {Mean}—A Poisson distribution with a defined {Mean}. The default value is 1.0. The value is of type double.
- GAMMA {Alpha}, {Beta}—A gamma distribution with a defined {Alpha} and {Beta}. 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 a defined {N} and {Probability}. The {N} is of type long with a default of 10. The {Probability} is of type double with a default of 0.5.
- GEOMETRIC {Probability}—A geometric distribution with a defined {Probability}. The default value is 0.5. The value is of type double.
- NEGATIVE BINOMIAL {r}, {Probability}—A Pascal distribution with a defined {r} and {Probability}. The {r} is of type double with a default of 10.0. The {Probability} is of type double with a default of 0.5.
| String |

raster_extent (Optional) | Set the extent of the output raster dataset. | Extent |

cellsize (Optional) | Define the spatial resolution of the output raster dataset. | Double |

## 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

- ArcGIS Desktop Basic: Requires 3D Analyst or Spatial Analyst
- ArcGIS Desktop Standard: Requires 3D Analyst or Spatial Analyst
- ArcGIS Desktop Advanced: Yes