Returns the elements of an array in random order.
Syntax
shuffle(array)Parameters
| Parameter | Description |
|---|---|
array | The input array. |
Return value
Returns the elements of the input array in random order. Returns null if the input is null.
The result of this function is undefined.
Examples
> SELECT shuffle(array(1, 20, 3, 5));
[3,1,5,20]
> SELECT shuffle(array(1, 20, null, 3));
[20,null,3,1]Related functions
SHUFFLE is a complex type function. For more information about functions that process ARRAY, MAP, STRUCT, and JSON data, see Complex type functions.