From: Tom Lane Date: Sat, 23 Jul 2022 23:00:30 +0000 (-0400) Subject: Doc: improve documentation about random(). X-Git-Tag: REL_12_12~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=042554d55d8539ea621ecf25d10d8c38ff1a2324;p=thirdparty%2Fpostgresql.git Doc: improve documentation about random(). We didn't explicitly say that random() uses a randomly-chosen seed if you haven't called setseed(). Do so. Also, remove ref/set.sgml's no-longer-accurate (and never very relevant) statement that the seed value is multiplied by 2^31-1. Back-patch to v12 where set.sgml's claim stopped being true. The claim that we use a source of random bits as seed was debatable before 4203842a1, too, so v12 seems like a good place to stop. Per question from Carl Sopchak. Discussion: https://postgr.es/m/f37bb937-9d99-08f0-4de7-80c91a3cfc2e@sopchak.me --- diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 8b4283e3cc4..44cc4875323 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1171,6 +1171,9 @@ subsequent random() calls in the current session are repeatable by re-issuing setseed() with the same argument. + Without any prior setseed() call in the same + session, the first random() call obtains a seed + from a platform-dependent source of random bits. diff --git a/doc/src/sgml/ref/set.sgml b/doc/src/sgml/ref/set.sgml index 63f312e812a..22d0e3f6e49 100644 --- a/doc/src/sgml/ref/set.sgml +++ b/doc/src/sgml/ref/set.sgml @@ -175,8 +175,7 @@ SET [ SESSION | LOCAL ] TIME ZONE { timezone Sets the internal seed for the random number generator (the function random). Allowed values are - floating-point numbers between -1 and 1, which are then - multiplied by 231-1. + floating-point numbers between -1 and 1 inclusive.