Re: [PATCH] random_normal function - Mailing list pgsql-hackers

From Paul Ramsey
Subject Re: [PATCH] random_normal function
Date
Msg-id FE7FB7D4-2304-4A62-BF99-E35D64BFE15B@cleverelephant.ca
Whole thread Raw
In response to Re: [PATCH] random_normal function  (Joe Conway <mail@joeconway.com>)
Responses Re: [PATCH] random_normal function  (Paul Ramsey <pramsey@cleverelephant.ca>)
List pgsql-hackers

> On Dec 9, 2022, at 11:01 AM, Joe Conway <mail@joeconway.com> wrote:
>
> On 12/9/22 13:51, Paul Ramsey wrote:
>>> On Dec 9, 2022, at 10:39 AM, Mark Dilger <mark.dilger@enterprisedb.com> wrote:
>>>> On Dec 8, 2022, at 1:53 PM, Paul Ramsey <pramsey@cleverelephant.ca> wrote:
>>>> Just a utility function to generate random numbers from a normal
>>>> distribution. I find myself doing this several times a year, and I am
>>>> sure I must not be the only one.
>>> Thanks for the patch.  What do you think about these results?
>> Angels on pins time! :)
>
> I just noticed this thread -- what is lacking in the normal_rand() function in the tablefunc contrib?
>
> https://www.postgresql.org/docs/current/tablefunc.html#id-1.11.7.52.5

Simplicity I guess mostly. random_normal() has a direct analogue in random() which is also a core function. I mean it
couldequally be pointed out that a user can implement their own Box-Muller calculation pretty trivially. Part of this
submissionis a personal wondering to what extent the community values convenience vs composibility. The set-returning
natureof normal_rand() may be a bit of a red herring to people who just want one value (even though normal_rand (1,
0.0,1.0) does exactly what they want). 

P.


pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: [PATCH] random_normal function
Next
From: Paul Ramsey
Date:
Subject: Re: [PATCH] random_normal function