From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net> |
Cc: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Proposal to introduce a shuffle function to intarray extension |
Date: | 2022-07-17 03:32:34 |
Message-ID: | CAKFQuwaMZHx-9NcnBTQV9ObVQfPKixcYbEEPtkJGEdjn-RcxJg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On Sat, Jul 16, 2022 at 7:25 PM Martin Kalcher <
martin(dot)kalcher(at)aboutsource(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2022-07-17 03:36:48 | Re: Proposal to introduce a shuffle function to intarray extension |
Previous Message | Tom Lane | 2022-07-17 03:18:29 | Re: Proposal to introduce a shuffle function to intarray extension |
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2022-07-17 03:36:48 | Re: Proposal to introduce a shuffle function to intarray extension |
Previous Message | David G. Johnston | 2022-07-17 03:23:59 | Re: doc: Make selectivity example match wording |