Subject: What seed does random() use if setseed() is not called first?

From: Carl Sopchak <[email-masked]>
Date: Sat, 23 Jul 2022 17:18:40 -0400

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?

Thanks for the help!

Carl

---

From: Tom Lane <[email-masked]>
Date: Sat, 23 Jul 2022 17:47:19 -0400

Carl Sopchak <[email-masked]> writes:
>     <p>There is one point about the documentation for random() and
>       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

---

From: Carl Sopchak <[email-masked]>
Date: Sat, 23 Jul 2022 17:55:40 -0400

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:

regards, tom lane

---

From: Tom Lane <[email-masked]>
Date: Sat, 23 Jul 2022 18:06:01 -0400

Carl Sopchak <[email-masked]> writes:
>     <p>Thank you for the quick reply!  But I wouldn't have bothered you
>       Linux/Unix, or &lt;???&gt; on Windows."</p>

Hmm, I thought this already was documented, but it looks like not.
I'll see what I can do.

			regards, tom lane

---

From: Carl Sopchak <[email-masked]>
Date: Sat, 23 Jul 2022 18:09:29 -0400

If it is, somewhere, it's not on the Mathematical Functions page
where random() and setseed() are documented.

Thanks again...

Carl

On 7/23/22 18:06, Tom Lane wrote:

regards, tom lane