listRandom

Syntax

string listRandom(stringList)

Parameters

Returns

Returns random item of stringList.

Description

This function returns a random item of the stringList.

Note.1: Getting a random element often is directly combined with a wildcard search. See examples.

Note.2: String lists are a series of strings stored inside one string. The elements are separated by a semicolon (";"). Each item must be followed by a semicolon, also the last one! The data type is "string", thus it is not an array as used in other scripting languages.

Related

Examples

listRandom("rule;your;city;")
# result = "rule" or "your" or "city" 

listRandom(fileSearch("/myProject/assets/*.jpg"))
# result = a random .jpg image from that directory.

listRandom(fileSearch("*.obj"))
# result = a random asset from the whole workspace.

Copyright ©2008-2023 Esri R&D Center Zurich. All rights reserved.