Re: [PATCH] Introduce array_shuffle() and array_sample()
| От | Tom Lane |
|---|---|
| Тема | Re: [PATCH] Introduce array_shuffle() and array_sample() |
| Дата | |
| Msg-id | 3943591.1664374725@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: [PATCH] Introduce array_shuffle() and array_sample() (Fabien COELHO <coelho@cri.ensmp.fr>) |
| Ответы |
Re: [PATCH] Introduce array_shuffle() and array_sample()
|
| Список | pgsql-hackers |
Fabien COELHO <coelho@cri.ensmp.fr> writes:
>> Thanks for your thoughts, Tom. I have a couple of questions. Should we
>> introduce a new seed function for the new PRNG state, used by array_shuffle()
>> and array_sample()? What would be a good name? Or should those functions use
>> pg_global_prng_state? Is it safe to assume, that pg_global_prng_state is
>> seeded?
> I'd suggest to use the existing global state. The global state should be
> seeded at the process start, AFAIKR.
It is seeded at process start, yes. If you don't feel a need for
user control over the sequence used by these functions, then using
pg_global_prng_state is fine. (Basically the point to be made
here is that we need to keep a tight rein on what can be affected
by setseed().)
regards, tom lane
В списке pgsql-hackers по дате отправления: