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

From: Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
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 15:43:02
Message-ID: 459f6008-90bc-bc52-6f11-e68570e03ac0@aboutsource.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Am 21.07.22 um 14:25 schrieb Dean Rasheed:
>
> 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 like the idea. How would you organize the code? I imagine some sort of
user prng that is encapsulated in something like utils/adt/random.c and
is guaranteed to always be seeded.

Martin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Meera Nair 2022-07-21 16:42:01 Unable to archive logs in standby server
Previous Message Guillaume Lelarge 2022-07-21 12:31:17 Re: Unable to archive logs in standby server

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2022-07-21 15:51:57 Re: [PATCH v1] eliminate duplicate code in table.c
Previous Message Tom Lane 2022-07-21 15:22:48 Re: postgres_fdw: Fix bug in checking of return value of PQsendQuery().