Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ocuXY-0002Wr-EG for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Sep 2022 20:17:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ocuXW-00071m-5t for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Sep 2022 20:17:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ocuXV-00071c-Ss for pgsql-hackers@lists.postgresql.org; Mon, 26 Sep 2022 20:17:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ocuXT-0003ZC-Dy for pgsql-hackers@lists.postgresql.org; Mon, 26 Sep 2022 20:17:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 28QKGP013502302; Mon, 26 Sep 2022 16:16:26 -0400 From: Tom Lane To: Martin Kalcher cc: Andres Freund , Fabien COELHO , Dean Rasheed , Robert Haas , Andrew Dunstan , John Naylor , Thomas Munro , PostgreSQL Hackers Subject: Re: [PATCH] Introduce array_shuffle() and array_sample() In-reply-to: <193caac5-941e-58b8-65e6-351f777ebd25@aboutsource.net> References: <459f6008-90bc-bc52-6f11-e68570e03ac0@aboutsource.net> <583b6409-df52-86d1-8c0a-ce8e74863ad7@aboutsource.net> <036ba529-1f25-d7b5-c5ad-e6c852d928df@aboutsource.net> <8fabf9e7-3422-58b0-93f6-d0976d4679df@aboutsource.net> <20220922152320.ukx6teo7wa7cuwkv@awork3.anarazel.de> <193caac5-941e-58b8-65e6-351f777ebd25@aboutsource.net> Comments: In-reply-to Martin Kalcher message dated "Thu, 22 Sep 2022 17:40:17 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3502300.1664223385.1@sss.pgh.pa.us> Date: Mon, 26 Sep 2022 16:16:25 -0400 Message-ID: <3502301.1664223385@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Martin Kalcher writes: > [ v4-0001-Introduce-array_shuffle-and-array_sample.patch ] I think this idea of exporting drandom()'s PRNG for all and sundry to use is completely misguided. If we go down that path we'll be right back in the swamp that we were in when we used random(3), namely that (a) it's not clear what affects what, and (b) to the extent that there are such interferences, it could be bad, maybe even a security problem. We very intentionally decoupled drandom() from the rest of the world at commit 6645ad6bd, and I'm not ready to unlearn that lesson. 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. regards, tom lane