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 1m0eL5-0005Ov-3s for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Jul 2021 06:13:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m0eL3-0007sA-UB for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Jul 2021 06:13:45 +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 1m0eL3-0007s1-MY for pgsql-hackers@lists.postgresql.org; Tue, 06 Jul 2021 06:13:45 +0000 Received: from sfr-1.cri.mines-paristech.fr ([77.158.180.225] helo=smtp.cri.ensmp.fr) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0eL0-0004tx-Iq for pgsql-hackers@lists.postgresql.org; Tue, 06 Jul 2021 06:13:44 +0000 Received: from petersbourg.cri.ensmp.fr (petersbourg.cri.ensmp.fr [10.2.14.5]) by smtp.cri.ensmp.fr (Postfix) with ESMTPSA id 17831C00FA; Tue, 6 Jul 2021 08:15:40 +0200 (CEST) Date: Tue, 6 Jul 2021 08:13:36 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@pseudo To: Yura Sokolov cc: Dean Rasheed , Tom Lane , Aleksander Alekseev , PostgreSQL Developers Subject: Re: rand48 replacement In-Reply-To: <3136e2672d5ab395521bae05a80df469@postgrespro.ru> Message-ID: References: <699567.1625156441@sss.pgh.pa.us> <746421.1625164869@sss.pgh.pa.us> <3136e2672d5ab395521bae05a80df469@postgrespro.ru> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Yura, > I believe most "range" values are small, much smaller than UINT32_MAX. > In this case, according to [1] fastest method is Lemire's one (I'd take > original version from [2]) [...] Yep. I share your point that the range is more often 32 bits. However, I'm not enthousiastic at combining two methods depending on the range, the function looks complex enough without that, so I would suggest not to take this option. Also, the decision process adds to the average cost, which is undesirable. I would certainly select the unbias multiply method if we want a u32 range variant. -- Fabien.