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 CAKFQuwaMZHx-9NcnBTQV9ObVQfPKixcYbEEPtkJGEdjn-RcxJg@mail.gmail.com
Whole thread Raw
In response to Re: Proposal to introduce a shuffle function to intarray extension  (Martin Kalcher <martin.kalcher@aboutsource.net>)
Responses Re: Proposal to introduce a shuffle function to intarray extension
List pgsql-hackers
On Sat, Jul 16, 2022 at 7:25 PM Martin Kalcher <martin.kalcher@aboutsource.net> wrote:

- 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. The
   important one is shuffle().


 +SELECT sample('{1,2,3,4,5,6,7,8,9,10,11,12}', 6) != sample('{1,2,3,4,5,6,7,8,9,10,11,12}', 6);
+ ?column?
+----------
+ t
+(1 row)
+

While small, there is a non-zero chance for both samples to be equal.  This test should probably just go, I don't see what it tests that isn't covered by other tests or even trivial usage.

Same goes for:

+SELECT shuffle('{1,2,3,4,5,6,7,8,9,10,11,12}') != shuffle('{1,2,3,4,5,6,7,8,9,10,11,12}');
+ ?column?
+----------
+ t
+(1 row)
+


David J.

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: doc: Make selectivity example match wording
Next
From: "David G. Johnston"
Date:
Subject: Re: Proposal to introduce a shuffle function to intarray extension