CreateRandomValueGenerator (arcpy)
Резюме
Создает новый генератор случайных чисел.
Синтаксис
CreateRandomValueGenerator (seed, distribution)
Параметр | Объяснение | Тип данных |
seed |
Инициализирует генератор случайных чисел. | Integer |
distribution |
Алгоритм генератора случайных чисел.
(Значение по умолчанию — ACM599) | String |
Тип данных | Объяснение |
Object |
Объект RandomNumberGenerator |
Пример кода
Пример CreateRandomValueGenerator
Создать и инициализировать объект генератора случайных чисел.
import arcpy
from arcpy import env
# 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.
#
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
#
val = float(result.getOutput(0))
print val
Связанные темы
9/10/2013