element_of |
Discworld driver help |
element_of |
Name
element_of() - get a random element of an array.
Synopsis
mixed element_of( mixed *arr );
Description
element_of() returns a random element of a given array. Trying to get an element of an empty array will give a runtime error.
Example
> exec return element_of( ({ 2, 3, 5, 7, 11 }) )
Returns: 5
> exec return element_of( ({ 2, 3, 5, 7, 11 }) )
Returns: 2