arcgis python 随机数 语法用法一例:
//---------------------------------------------
//定义函数getnums 返回一个随机数(0,5)
def getnums():
return arcgis.rand('Integer 0 5')
调用方法
Expression: getnums()
Expression Type: PYTHON_9.3
--the--end---
————————————————-------------------------------------------------
#coding:UTF-8 import time import random import re # 根据时间返回,返回随机年月日时间 def getRandomDate(sYear, sMonth, sDay, eYear, eMonth, eDay): a1=(sYear,sMonth,sDay,0,0,0,0,0,0) a2=(eYear,eMonth,eDay,23,59,59,0,0,0) start=time.mktime(a1) end=time.mktime(a2) t=random.randint(start,end) date_touple=time.localtime(t) date=time.strftime("%Y/%m/%d",date_touple) return date
调用:getRandomDate(2010,1,1,2019,1,1)