Random Number Generator (Environment setting)
Tools that use the Random Number Generator environment use algorithms that use the seed and distribution to produce a sequence of random numbers.
Usage notes
If a tool using the random values (for example, Create Random Raster, Create Random Points, or Calculate Value) runs twice with the same seed, the output is identical. Control over the seed allows you to reproduce your results.
If a random number generator is defined globally, one stream of random values is created. Each subsequent tool or tools within a ModelBuilder model pulls the next available value from the stream as needed.
Multiple random number generator streams can be used in a ModelBuilder model by creating them locally for the desired tools that use random numbers. Each tool can have its own stream from which to pull random values as needed. Only the tool with the local stream can pull values from that stream. There is no limit to the number of local streams.
-
Legacy:
arcgis.rand()is no longer supported as of ArcGIS Pro 2.0. Thearcgis.rand()function was primarily used to support creation of random values with the Calculate Value and Calculate Field tools, the Random Number Generator environment setting, and theCreateRandomValueGeneratorfunction. Comparable functions using Python'srandommodule should be used instead.
Dialog syntax
Seed—The seed is an integer value and is used to initiate the random number generator. The default value is 0.
Random Generator Type—The random generator algorithm.
ACM599—ACM collected algorithm 599. This is the default.
MERSENNE_TWISTER—Mersenne Twister mt19937.
STANDARD_C—Standard C Rand.
Python syntax
arcpy.env.randomGenerator = random_generator_option
| Name | Explanation |
|---|---|
|
random_generator_option |
Provide the value as a seed and optional distribution.
The value can also be provided as a |
Scripting syntax
import arcpy
# Set the random generator to ACM599 with random seed of 99
arcpy.env.randomGenerator = "99 ACM599"