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 1oEYKd-0005Tw-4e for pgsql-hackers@arkaria.postgresql.org; Thu, 21 Jul 2022 15:43:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oEYKa-0001yJ-FP for pgsql-hackers@arkaria.postgresql.org; Thu, 21 Jul 2022 15:43:16 +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 1oEYKa-0001rp-4O for pgsql-hackers@lists.postgresql.org; Thu, 21 Jul 2022 15:43:16 +0000 Received: from mout-b-105.mailbox.org ([2001:67c:2050:102:465::105]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oEYKX-0001s0-1H for pgsql-hackers@lists.postgresql.org; Thu, 21 Jul 2022 15:43:14 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-105.mailbox.org (Postfix) with ESMTPS id 4LpcKP3gS0z9slk; Thu, 21 Jul 2022 17:43:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aboutsource.net; s=MBO0001; t=1658418185; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xaY7l2JGGdvY+uC3nAdOIU2pLmuO59ShoxTho/LmBSQ=; b=ZJm1UB8ZgimLl1k7JmfNcuDoANsFv8MWUy9JBW1XNnwr0OyO99PuB5OhJ1ylcL8+bhXG2r PCMMven2ZZov/xS6muAMTv1clRDF6m4kBsFwD06+/QJ/175m6qiZP32f2o47yXwM0Thwge 0ivicXQY8ByD+KkKOrJRf6oJXAVRjYIjtbYW/yCOplY/hlgYqy5XBzxB88vIiXEnBcaRdo F1gRKmwOvSBOdvZzLhvpK8nXfcggRm1cw/xwbXEkQes77SPSCm41dEDitYrY76AAewwJnV Z4wGQ26i49pzdW8IRwofLIWHK4BQmPV8Z4ZNuvHBBSgJCg7WiW3T4Yo7VGVVGw== Message-ID: <459f6008-90bc-bc52-6f11-e68570e03ac0@aboutsource.net> Date: Thu, 21 Jul 2022 17:43:02 +0200 MIME-Version: 1.0 Content-Language: de-DE To: Dean Rasheed Cc: Tom Lane , Robert Haas , Andrew Dunstan , John Naylor , Thomas Munro , PostgreSQL Hackers References: <9d160a44-7675-51e8-60cf-6d64b76db831@aboutsource.net> <5b7a1ee9-f942-2502-3a0c-e9fc12511139@aboutsource.net> <469954.1658100033@sss.pgh.pa.us> <687490.1658152096@sss.pgh.pa.us> <1708d95a-629e-5ac5-deab-d20a8d0b2b0e@aboutsource.net> <809171.1658176490@sss.pgh.pa.us> <817328.1658178181@sss.pgh.pa.us> <0b5dea2b-37fa-6c81-ea9d-0341ab6f87d6@aboutsource.net> <091a9f69-1e5d-6558-41a7-2607a5fc9ff7@aboutsource.net> <1064800.1658240423@sss.pgh.pa.us> <7e7cf274-09cb-00cf-1715-979f011e40b0@aboutsource.net> From: Martin Kalcher Subject: Re: [PATCH] Introduce array_shuffle() and array_sample() In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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