From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: [PATCH] Introduce array_shuffle() and array_sample() |
Date: | 2022-07-21 12:25:27 |
Message-ID: | CAEZATCVOJHxWOG7DvEjkL_Y-h6f-HK-VkFpsdP76pa6y7xsW7Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On Thu, 21 Jul 2022 at 12:15, Martin Kalcher
<martin(dot)kalcher(at)aboutsource(dot)net> wrote:
>
> I agree that we should use pg_prng_uint64_range(). However, in order to
> achieve interoperability with setseed() we would have to use
> drandom_seed (rather than pg_global_prng_state) as rng state, which is
> declared statically in float.c and exclusively used by random(). Do we
> want to expose drandom_seed to other functions?
>
Ah, I didn't realise that setseed() and random() were bound up so
tightly. It does feel as though, if we're adding more user-facing
functions that return random sequences, there ought to be a way to
seed them, and I wouldn't want to have separate setseed functions for
each one.
I'm inclined to say that we want a new pg_global_prng_user_state that
is updated by setseed(), and used by random(), array_shuffle(),
array_sample(), and any other user-facing random functions we add
later.
I can also see that others might not like expanding the scope of
setseed() in this way.
Regards,
Dean
From | Date | Subject | |
---|---|---|---|
Next Message | Guillaume Lelarge | 2022-07-21 12:31:17 | Re: Unable to archive logs in standby server |
Previous Message | Martin Kalcher | 2022-07-21 11:15:43 | Re: [PATCH] Introduce array_shuffle() and array_sample() |
From | Date | Subject | |
---|---|---|---|
Next Message | Bilal Yavuz | 2022-07-21 12:26:05 | Re: [RFC] building postgres with meson - v10 |
Previous Message | Alvaro Herrera | 2022-07-21 12:18:24 | Re: [PATCH v1] eliminate duplicate code in table.c |