Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 75fdcec

Browse files
committed
Improve documentation of random() function.
Move random() and setseed() to a separate table, to have them grouped together. Also add a notice that random() is not cryptographically secure. Original patch by Honza Horak, although I didn't use his version.
1 parent 138184a commit 75fdcec

File tree

1 file changed

+50
-27
lines changed

1 file changed

+50
-27
lines changed

doc/src/sgml/func.sgml

+50-27
Original file line numberDiff line numberDiff line change
@@ -828,19 +828,6 @@
828828
<entry><literal>0.785398163397448</literal></entry>
829829
</row>
830830

831-
<row>
832-
<entry>
833-
<indexterm>
834-
<primary>random</primary>
835-
</indexterm>
836-
<literal><function>random()</function></literal>
837-
</entry>
838-
<entry><type>dp</type></entry>
839-
<entry>random value in the range 0.0 &lt;= x &lt; 1.0</entry>
840-
<entry><literal>random()</literal></entry>
841-
<entry></entry>
842-
</row>
843-
844831
<row>
845832
<entry>
846833
<indexterm>
@@ -862,20 +849,6 @@
862849
<entry><literal>42.44</literal></entry>
863850
</row>
864851

865-
<row>
866-
<entry>
867-
<indexterm>
868-
<primary>setseed</primary>
869-
</indexterm>
870-
<literal><function>setseed(<type>dp</type>)</function></literal>
871-
</entry>
872-
<entry><type>void</type></entry>
873-
<entry>set seed for subsequent <literal>random()</literal> calls (value between -1.0 and
874-
1.0, inclusive)</entry>
875-
<entry><literal>setseed(0.54823)</literal></entry>
876-
<entry></entry>
877-
</row>
878-
879852
<row>
880853
<entry>
881854
<indexterm>
@@ -951,6 +924,56 @@
951924
</tgroup>
952925
</table>
953926

927+
<para>
928+
<xref linkend="functions-math-random-table"> shows functions for
929+
generating random numbers.
930+
</para>
931+
932+
<table id="functions-math-random-table">
933+
<title>Random Functions</title>
934+
935+
<tgroup cols="3">
936+
<thead>
937+
<row>
938+
<entry>Function</entry>
939+
<entry>Return Type</entry>
940+
<entry>Description</entry>
941+
</row>
942+
</thead>
943+
<tbody>
944+
<row>
945+
<entry>
946+
<indexterm>
947+
<primary>random</primary>
948+
</indexterm>
949+
<literal><function>random()</function></literal>
950+
</entry>
951+
<entry><type>dp</type></entry>
952+
<entry>random value in the range 0.0 &lt;= x &lt; 1.0</entry>
953+
</row>
954+
955+
<row>
956+
<entry>
957+
<indexterm>
958+
<primary>setseed</primary>
959+
</indexterm>
960+
<literal><function>setseed(<type>dp</type>)</function></literal>
961+
</entry>
962+
<entry><type>void</type></entry>
963+
<entry>set seed for subsequent <literal>random()</literal> calls (value between -1.0 and
964+
1.0, inclusive)</entry>
965+
</row>
966+
</tbody>
967+
</tgroup>
968+
</table>
969+
970+
<para>
971+
The characteristics of the values returned by
972+
<literal><function>random()</function></literal> depend
973+
on the system implementation. It is not suitable for cryptographic
974+
applications; see <xref linkend="pgcrypto"> module for an alternative.
975+
</para>
976+
954977
<para>
955978
Finally, <xref linkend="functions-math-trig-table"> shows the
956979
available trigonometric functions. All trigonometric functions

0 commit comments

Comments
 (0)