This is an automated email from the ASF dual-hosted git repository.

reshke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 8202172aff1894347153112aa411d4226759c7b3
Author: Tom Lane <[email protected]>
AuthorDate: Sat Jul 23 19:00:30 2022 -0400

    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/[email protected]
---
 doc/src/sgml/func.sgml    | 3 +++
 doc/src/sgml/ref/set.sgml | 3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index ceb09d788cc..16ad120dd23 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1840,6 +1840,9 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
    subsequent <function>random()</function> calls in the current session
    can be repeated by re-issuing <function>setseed()</function> with the same
    argument.
+   Without any prior <function>setseed()</function> call in the same
+   session, the first <function>random()</function> call obtains a seed
+   from a platform-dependent source of random bits.
   </para>
 
   <para>
diff --git a/doc/src/sgml/ref/set.sgml b/doc/src/sgml/ref/set.sgml
index 339ee9eec94..c4aab56a2d3 100644
--- a/doc/src/sgml/ref/set.sgml
+++ b/doc/src/sgml/ref/set.sgml
@@ -175,8 +175,7 @@ SET [ SESSION | LOCAL ] TIME ZONE { <replaceable 
class="parameter">timezone</rep
       <para>
        Sets the internal seed for the random number generator (the
        function <function>random</function>).  Allowed values are
-       floating-point numbers between -1 and 1, which are then
-       multiplied by 2<superscript>31</superscript>-1.
+       floating-point numbers between -1 and 1 inclusive.
       </para>
 
       <para>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to