apoc.coll.randomItem

Details

Syntax

apoc.coll.randomItem(coll)

Description

Returns a random item from the LIST<ANY>, or null on LIST<NOTHING> or LIST<NULL>.

Arguments

Name

Type

Description

coll

LIST<ANY>

The list to return a random item from.

Returns

ANY

Usage examples

The following returns a random value from a list:

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

7