From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com> |
Cc: | David Zhang <david(dot)zhang(at)highgo(dot)ca>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Functions to return random numbers in a given range |
Date: | 2024-03-26 06:57:25 |
Message-ID: | CAEZATCX=EVZJdqGTgB-4W4Fw4Un8bdnMng1+v4ioFxfTWe4nRQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 27 Feb 2024 at 17:33, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
>
> On Sat, 24 Feb 2024 at 17:10, Tomas Vondra
> >
> > I did a quick review and a little bit of testing on the patch today. I
> > think it's a good/useful idea, and I think the code is ready to go (the
> > code is certainly much cleaner than anything I'd written ...).
>
Based on the reviews so far, I think this is ready for commit, so
unless anyone objects, I will do so in a day or so.
As a quick summary, this adds a new file:
src/backend/utils/adt/pseudorandomfuncs.c
which contains SQL-callable functions that access a single shared
pseudorandom number generator, whose state is private to that file.
Currently the functions are:
random() returns double precision [moved from float.c]
random(min integer, max integer) returns integer [new]
random(min bigint, max bigint) returns bigint [new]
random(min numeric, max numeric) returns numeric [new]
random_normal() returns double precision [moved from float.c]
setseed(seed double precision) returns void [moved from float.c]
It's possible that functions to return other random distributions or
other datatypes might get added in the future, but I have no plans to
do so at the moment.
Regards,
Dean
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2024-03-26 07:04:28 | Re: Built-in CTYPE provider |
Previous Message | shveta malik | 2024-03-26 06:34:26 | Re: Introduce XID age and inactive timeout based replication slot invalidation |