ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

CreateRandomValueGenerator

  • Summary
  • Syntax
  • Code sample

Summary

Creates a new random number generator.

Syntax

CreateRandomValueGenerator (seed, distribution)
ParameterExplanationData Type
seed

Initializes the random number generator.

Integer
distribution

The random generation algorithm.

  • ACM599 —ACM collected algorithm 599
  • MERSENNE_TWISTER —Mersenne Twister mt19937
  • STANDARD_C —Standard C Rand

(The default value is ACM599)

String

Return Value

Data TypeExplanation
Object

The RandomNumberGenerator object.

Code sample

CreateRandomValueGenerator example

Create and initialize random number generator object.

import arcpy

# CreateRandomValueGenerator takes 2 arguments, seed and distribution
# method. The distribution method options are ACM599,
# MERSENNE_TWISTER, and STANDARD_C.
#
# The gen variable is a randomNumberGenerator object that is assigned
# to the randomGenerator environments setting.
arcpy.env.randomGenerator = arcpy.CreateRandomValueGenerator(20, "STANDARD_C")

# Calculate a random number using the ArcGIS.Rand() function
result = arcpy.CalculateValue_management("arcgis.rand('normal 0.0 10.0')")

# Print the returned value from the Result object
print(float(result.getOutput(0)))

Related topics

  • RandomNumberGenerator
  • Calculate Value
  • Calculate Field
  • Create Random Points
  • Create Random Raster
  • Random Number Generator (Environment setting)

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2019 Esri. | Privacy | Legal