In PostgreSQL array_sample() is a system function that returns an array of a specified number of items randomly selected from the given array.
The array_sample() function was introduced in PostgreSQL 16, which was released on September 14th 2023.