RandomNumberGenerator
サマリ
Determines the type and seed that will be used to create random numbers between 0 and 1 for all tools that utilize random numbers, for example, CreateRandomRaster, CreateRandomPoints, and the ArcGIS.Rand() function.
Returned from the randomGenerator environment.
メソッドの概要
メソッド | 説明 |
exportToString () |
Exports the object to its string representation. |
loadFromString (string) |
Restore the object using its string representation. The exportToString method can be used to create a string representation. |
メソッド
exportToString ()
データ タイプ | 説明 |
String |
The string representation of the object. |
loadFromString (string)
パラメータ | 説明 | データ タイプ |
string |
The string representation of the object. | String |
コードのサンプル
RandomNumberGenerator example
Demonstrate how to create a random number generator object.
import arcpy from arcpy import env # Cannot create RandomNumberGenerator object directly, # but is returned from CreateRandomValueGenerator function. # # CreateRandomValueGenerator takes 2 arguments, seed and distribution method. # The distribution method options are ACM599, # MERSENNE_TWISTER, 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')") # Get the value from the result object and print it to the Python window. # val = float(result.getOutput(0)) print val
関連項目
7/10/2012