From: | Paul Ramsey <pramsey(at)cleverelephant(dot)ca> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] random_normal function |
Date: | 2022-12-15 20:53:40 |
Message-ID: | DAB1B42C-4611-46CE-916C-A84BE610BE88@cleverelephant.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Dec 14, 2022, at 9:17 PM, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Tue, Dec 13, 2022 at 03:51:11PM -0800, Paul Ramsey wrote:
>> Clearing up one CI failure.
>
> +-- normal values converge on stddev == 2.0
> +SELECT round(stddev(random_normal(2, 2)))
> + FROM generate_series(1, 10000);
>
> I am not sure that it is a good idea to make a test based on a random
> behavior that should tend to a normalized value. This is costly in
> cycles, requiring a lot of work just for generate_series(). You could
> do the same kind of thing as random() a few lines above?
>
> +SELECT bool_and(random_string(16) != random_string(16)) AS same
> + FROM generate_series(1,8);
> That should be fine in terms of impossible chances :)
>
> + ereport(ERROR,
> + (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> + errmsg("return size must be non-negative")))
> This could have a test, same for 0.
>
> +#ifndef M_PI
> +#define M_PI 3.14159265358979323846
> +#endif
> Postgres' float.h includes one version of that.
Thanks again!
P
Attachment | Content-Type | Size |
---|---|---|
random_normal_07a.patch | application/octet-stream | 8.3 KB |
random_normal_07b.patch | application/octet-stream | 3.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2022-12-15 21:33:13 | Re: Speedup generation of command completion tags |
Previous Message | Nikita Malakhov | 2022-12-15 20:37:15 | Re: Pluggable toaster |