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 1oFN6G-0002e6-Kc for pgsql-sql@arkaria.postgresql.org; Sat, 23 Jul 2022 21:55:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oFN6E-0006WK-Vr for pgsql-sql@arkaria.postgresql.org; Sat, 23 Jul 2022 21:55:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oFN6E-0006WB-Mo for pgsql-sql@lists.postgresql.org; Sat, 23 Jul 2022 21:55:50 +0000 Received: from mout.perfora.net ([74.208.4.194]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oFN67-0008PJ-N5 for pgsql-sql@lists.postgresql.org; Sat, 23 Jul 2022 21:55:49 +0000 Received: from [10.221.133.171] ([142.105.135.230]) by mrelay.perfora.net (mreueus003 [74.208.5.2]) with ESMTPSA (Nemesis) id 0LxhYD-1nRdrS0WMd-017GO8; Sat, 23 Jul 2022 23:55:41 +0200 Message-ID: Date: Sat, 23 Jul 2022 17:55:40 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: What seed does random() use if setseed() is not called first? Content-Language: en-US To: Tom Lane Cc: pgsql-sql@lists.postgresql.org References: <1220338.1658612839@sss.pgh.pa.us> From: Carl Sopchak In-Reply-To: <1220338.1658612839@sss.pgh.pa.us> Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:Z256EZHH5nIzpnATbUtyluCWOouOt+PX4Gs3KVdpwteYWn70oRC EnP4bFq2kIpU01aal/ekBmUuklDEGUTWLKBQLLy7eyQUOToeoNrRHzfnULevBWJWzopzfrw ihNsdfsTqtC4Wf+NKEGt1qEAvZ55jhD8hJ+woGA8Ioh4IDOm4D4LCC2fFU2huK+Im8dm5ld KpZzzsZZJ4dPAZp/Jbabg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:d3sDDpItvEw=:xOhuwGRDXNckUSGAxyRuSO GMtf1T1gDnFjtyDATGEPELZAcC81ovspVcO+NB+BO8Wc6wLm8wSWlBrUWrtpgoJVK3cea5kWU mhNnoWpqt6NKw76xPSDtwWmDZ05yN2Aqm73nLKmQRd4FLQUN5/jXoZSnACRa/qV6Co0/1fZqD 2q8sxLzNkrkGQzQwq1qYoBaJMyrv5+bfjnoPdRlRQbFFFCTrpAT/U0SduDq0NoT6X/gCA2iEd tMbyArjyyeXyIkgi4cEXFn/5SlWcvwiMzWAe5CAdOsdkVQ+CbPexW0SAORBGSWlI2EdgisOBA kUcmsMyuhleuIewnOgRXRGaCeL6UoUGP/pdwzmJPcALPeAMauoWhAtBFWgiEKIC4bhgoEOh7W 2P3lguB/TjhBjWOTytzM0alMTHnD5mtEQFLyujSgzB31QE6nsQW8yoRBW+lpnl2Psx+ldnqdb mshQ4W6THcaXWYLbq4dZra/DB2BcPak/AzIs6EFiHib1DVBuJJcWNfdlo5FTy+rHzSauMUjr9 5Vduqx/PsQNBA5QjqRpbL3diyn5WX6jIB+n3dgiyD0oUiWVaziAXMPNVes/yArUL05Vh7XKzw yeX11qinjraeNwp1yz/LoZUyCJceQmdEIrm+wldgCN70O4udcUnprLIvGmCxMBUPM/IyZ4Ogl wa+WuazBzr/SmXqlEWl8lPTExgtrETRniDRkzZ5nnw+3iPJVurJjBx7VpXHefnAjAAiVwAXrC zmNtMrChiM7BqLVSPzMBzTFbQCmK5tBsV7DMuw== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk

Thank you for the quick reply!  But I wouldn't have bothered you if the documentation stated something to the effect of "While it's platform-dependent, if setseed() is not called, the random number generator is generally seeded by whatever method the operating system provides as a source of randomness, such as /dev/urandom on Linux/Unix, or <???> on Windows."

Just a suggestion, hope this helps, and thanks again!

Carl

On 7/23/22 17:47, Tom Lane wrote:
Carl Sopchak <carl@sopchak.me> writes:
    <p>There is one point about the documentation for random() and
      setseed() that is missing.  What is used to seed random() if
      setseed() isn't called first?  I assume it's something like
      /dev/random or /dev/urandom, but that's just a guess.  Can someone
      please enlighten me?</p>
We don't document this because it's platform- and version-dependent,
but yeah, generally /dev/urandom or local equivalent.

			regards, tom lane