v.23.2New Feature

Introduce arrayShuffle Function for Random Array Permutations

Introduce arrayShuffle function for random array permutations. #45271 (Joanna Hulboj).
Introduce arrayShuffle function for random array permutations.

Why it matters

The arrayShuffle function provides a way to randomly permute the elements of an array, enabling users to create randomized orderings of array data within ClickHouse queries. This is useful for sampling, randomized algorithms, or any scenario where randomized array order is required.

How to use it

Use the arrayShuffle function by passing an array as an argument in your query. For example:

SELECT arrayShuffle([1, 2, 3, 4, 5]) AS shuffled_array


This will return the input array in a random order each time it is called.