This is the ThingsDB documentation for version v0, click here for the latest version!
This function returns a pseudo-random item from a list or tuple . The array must contain at least one item, otherwise a lookup_err() is raised.
This function does not generate an event.
array.choice()
None
A pseudo-random item from the array.
This code shows an example using choice():
// Returns either `a`, `b` or `c`
['a', 'b', 'c'].choice();
Example return value in JSON format
"b"