Re: [PATCH] random_normal function
Paul Ramsey <pramsey@cleverelephant.ca>
From: Paul Ramsey <pramsey@cleverelephant.ca>
To: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2022-12-13T23:51:11Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Round off random_normal() test results one more decimal place.
- 02d552c4f422 16.0 landed
-
Remove pg_regress' never-documented "ignore" feature.
- bd8d453e9b5f 16.0 landed
-
Upgrade the random.sql regression test.
- 09d517773f60 16.0 landed
-
Invent random_normal() to provide normally-distributed random numbers.
- 38d81760c4d7 16.0 landed
Attachments
- random_normal_06a.patch (application/octet-stream) patch
- random_normal_06b.patch (application/octet-stream) patch
> On Dec 9, 2022, at 3:20 PM, Paul Ramsey <pramsey@cleverelephant.ca> wrote: > > > >> On Dec 9, 2022, at 9:17 AM, Paul Ramsey <pramsey@cleverelephant.ca> wrote: >> >> >>> On Dec 8, 2022, at 8:29 PM, Michael Paquier <michael@paquier.xyz> wrote: >>> >>> On Thu, Dec 08, 2022 at 04:44:56PM -0800, Paul Ramsey wrote: >>>> Final tme, with fixes from cirrusci. >>> >>> Well, why not. Seems like you would use that a lot with PostGIS. >>> >>> #include <math.h> /* for ldexp() */ >>> +#include <float.h> /* for DBL_EPSILON */ >>> And be careful with the order here. >> >> Should be ... alphabetical? >> >>> +static void >>> +drandom_check_default_seed() >>> We always use (void) rather than empty parenthesis sets. >> >> OK >> >>> I would not leave that unchecked, so I think that you should add >>> something in ramdom.sql. Or would you prefer switching some of >>> the regression tests be switched so as they use the new normal >>> function? >> >> Reading through those tests... seems like they will (rarely) fail. Is that... OK? >> The tests seem to be mostly worried that random() starts returning constants, which seems like a good thing to test for (is the random number generating returning randomness). >> An obvious test for this function is that the mean and stddev converge on the supplied parameters, given enough inputs, which is actually kind of the opposite test. I use the same random number generator as the uniform distribution, so that aspect is already covered by the existing tests. >> >>> (Ahem. Bonus points for a random_string() returning a bytea, based on >>> pg_strong_random().) >> >> Would love to. Separate patch of bundled into this one? > > Here's the original with suggestions applied and a random_string that applies on top of it. > > Thanks! > > P Clearing up one CI failure.