Skip To Content

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

  • Legacy:

    arcgis.rand() is no longer supported as of ArcGIS Pro 2.0. The arcgis.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 the CreateRandomValueGenerator function. Comparable functions using Python's random module 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.

Scripting syntax

arcpy.env.randomGenerator = random_generator_option

random_generator_optionExplanation

seed {distribution}

  • The seed is an integer value and is used to initiate the random number generator. The default value is 0.
  • The distribution is the random generation algorithm.
    • ACM599—ACM collected algorithm 599. This is the default.
    • MERSENNE_TWISTER—Mersenne Twister mt19937.
    • STANDARD_C—Standard C Rand.

RandomNumberGenerator class

A RandomNumberGenerator can be created using the CreateRandomValueGenerator function or returned from the randomGenerator environment.

randomGenerator syntax

Related topics