Re: Proposal to introduce a shuffle function to intarray extension - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Proposal to introduce a shuffle function to intarray extension
Date
Msg-id CAKFQuwZ19DYu1pdfsCqkjHbKh103vOGky2u8PTV23d4k=UnK6A@mail.gmail.com
Whole thread Raw
In response to Re: Proposal to introduce a shuffle function to intarray extension  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sat, Jul 16, 2022 at 8:18 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Martin Kalcher <martin.kalcher@aboutsource.net> writes:

> - I added a second function sample(), because it is a lot faster to take
>    some elements from an array than to shuffle the whole array and
>    slice it. This function can be removed if it is not wanted.

I have no opinion about whether this one is valuable enough to include in
intarray, but I do feel like sample() is a vague name, and easily confused
with marginally-related operations like TABLESAMPLE.  Can we think of a
more on-point name?  Something like "random_subset" would be pretty
clear, but it's also clunky.  It's too late here for me to think of
le mot juste...


choose(input anyarray, size integer, with_replacement boolean default false, algorithm text default 'default')?

David J.

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Proposal to introduce a shuffle function to intarray extension
Next
From: Tom Lane
Date:
Subject: Re: Proposal to introduce a shuffle function to intarray extension