apoc.coll.randomItem

Function APOC Core

apoc.coll.randomItem(coll)- returns a random item from the list, or null on an empty or null list

Signature

apoc.coll.randomItem(coll :: LIST? OF ANY?) :: (ANY?)

Input parameters

Name Type Default

coll

LIST? OF ANY?

null

Usage Examples

The following returns a random value from a list:

RETURN apoc.coll.randomItem([1,3,5,7,9]) AS output;
Table 1. Results
Output

7