Content-Length: 286923 | pFad | http://github.com/postgrespro/postgres/commit/bd6cfbf338e5c3d65b9271f632142716d67d7c34

1D Doc: improve documentation about random(). · postgrespro/postgres@bd6cfbf · GitHub
Skip to content

Commit bd6cfbf

Browse files
committed
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 4203842, 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
1 parent 44d0e41 commit bd6cfbf

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

doc/src/sgml/func.sgml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,9 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
18411841
subsequent <function>random()</function> calls in the current session
18421842
can be repeated by re-issuing <function>setseed()</function> with the same
18431843
argument.
1844+
Without any prior <function>setseed()</function> call in the same
1845+
session, the first <function>random()</function> call obtains a seed
1846+
from a platform-dependent source of random bits.
18441847
</para>
18451848

18461849
<para>

doc/src/sgml/ref/set.sgml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ SET [ SESSION | LOCAL ] TIME ZONE { <replaceable class="parameter">timezone</rep
177177
<para>
178178
Sets the internal seed for the random number generator (the
179179
function <function>random</function>). Allowed values are
180-
floating-point numbers between -1 and 1, which are then
181-
multiplied by 2<superscript>31</superscript>-1.
180+
floating-point numbers between -1 and 1 inclusive.
182181
</para>
183182

184183
<para>

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/bd6cfbf338e5c3d65b9271f632142716d67d7c34

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy