Re: [PATCH] Introduce array_shuffle() and array_sample()

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, 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-09-28 13:07:06
Message-ID: a81b3160-bb4-8b9e-8f3f-ff45c88fb3a3@mines-paristech.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


>> With our current PRNG infrastructure it doesn't cost much to have
>> a separate PRNG for every purpose. I don't object to having
>> array_shuffle() and array_sample() share one PRNG, but I don't
>> think it should go much further than that.
>
> 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.

--
Fabien.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-09-28 14:18:45 Re: [PATCH] Introduce array_shuffle() and array_sample()
Previous Message Alvaro Herrera 2022-09-28 11:13:06 Re: is there still a memory leak with hash joins in PG 12.11 ?

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-09-28 13:07:28 Re: longfin and tamandua aren't too happy but I'm not sure why
Previous Message Robert Haas 2022-09-28 12:57:49 Re: longfin and tamandua aren't too happy but I'm not sure why