Re: Functions to return random numbers in a given range

2024-03-27 Thread Dean Rasheed
On Tue, 26 Mar 2024 at 06:57, Dean Rasheed wrote: > > 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. > Committed. Thanks for the reviews. Regards, Dean

Re: Functions to return random numbers in a given range

2024-03-26 Thread Dean Rasheed
On Tue, 27 Feb 2024 at 17:33, Dean Rasheed 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

Re: Functions to return random numbers in a given range

2024-02-27 Thread Dean Rasheed
On Sat, 24 Feb 2024 at 17:10, Tomas Vondra wrote: > > Hi Dean, > > 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 ...). > Thanks for

Re: Functions to return random numbers in a given range

2024-02-24 Thread Tomas Vondra
Hi Dean, 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 ...). I do have one minor comments regarding the docs - it refers to "random functions"

Re: Functions to return random numbers in a given range

2024-01-30 Thread Dean Rasheed
On Tue, 30 Jan 2024 at 12:47, Aleksander Alekseev wrote: > > Maybe I'm missing something but I'm not sure if I understand what this > test tests particularly: > > ``` > -- There should be no triple duplicates in 1000 full-range 32-bit random() > -- values. (Each of the C(1000, 3) choices of

Re: Functions to return random numbers in a given range

2024-01-30 Thread Aleksander Alekseev
Hi, > Interestingly, the cfbot didn't pick up on the fact that it needed > rebasing. Anyway, the copyright years in the new file's header comment > needed updating, so here is a rebase doing that. Maybe I'm missing something but I'm not sure if I understand what this test tests particularly:

Re: Functions to return random numbers in a given range

2024-01-29 Thread Dean Rasheed
On Fri, 26 Jan 2024 at 20:44, David Zhang wrote: > > Thank you for the patch. > > I applied this patch manually to the master branch, resolving a conflict > in `numeric.h`. It successfully passed both `make check` and `make > check-world`. > Thanks for testing. Interestingly, the cfbot didn't

Re: Functions to return random numbers in a given range

2024-01-29 Thread Dean Rasheed
On Thu, 28 Dec 2023 at 07:34, jian he wrote: > > Your patch works. > performance is the best amount for other options in [0]. > I don't have deep knowledge about which one is more random. > Thanks for testing. > Currently we have to explicitly mention the lower and upper bound. > but can we do

Re: Functions to return random numbers in a given range

2024-01-26 Thread David Zhang
Thank you for the patch. I applied this patch manually to the master branch, resolving a conflict in `numeric.h`. It successfully passed both `make check` and `make check-world`. Best regards, David

Re: Functions to return random numbers in a given range

2023-12-27 Thread jian he
On Fri, Dec 22, 2023 at 1:07 AM Dean Rasheed wrote: > > Attached is a patch that adds 3 SQL-callable functions to return > random integer/numeric values chosen uniformly from a given range: > > random(min int, max int) returns int > random(min bigint, max bigint) returns bigint > random(min

Re: Functions to return random numbers in a given range

2023-12-21 Thread Pavel Stehule
Hi čt 21. 12. 2023 v 18:06 odesílatel Dean Rasheed napsal: > Attached is a patch that adds 3 SQL-callable functions to return > random integer/numeric values chosen uniformly from a given range: > > random(min int, max int) returns int > random(min bigint, max bigint) returns bigint >

Functions to return random numbers in a given range

2023-12-21 Thread Dean Rasheed
Attached is a patch that adds 3 SQL-callable functions to return random integer/numeric values chosen uniformly from a given range: random(min int, max int) returns int random(min bigint, max bigint) returns bigint random(min numeric, max numeric) returns numeric The return value is in the