diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2013-10-24 15:39:30 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2013-10-24 15:40:23 +0300 |
commit | 75fdcec14543b60cc0c67483d8cc47d5c7adf1a8 (patch) | |
tree | 04760cd3d5e22bcfa4335af19fad424280b511b0 /doc/src | |
parent | 138184adc5f7c60c184972e4d23f8cdb32aed77d (diff) | |
download | postgresql-75fdcec14543b60cc0c67483d8cc47d5c7adf1a8.tar.gz postgresql-75fdcec14543b60cc0c67483d8cc47d5c7adf1a8.zip |
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.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 77 |
1 files changed, 50 insertions, 27 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index e397386bf24..2b91e6e86a0 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -831,19 +831,6 @@ <row> <entry> <indexterm> - <primary>random</primary> - </indexterm> - <literal><function>random()</function></literal> - </entry> - <entry><type>dp</type></entry> - <entry>random value in the range 0.0 <= x < 1.0</entry> - <entry><literal>random()</literal></entry> - <entry></entry> - </row> - - <row> - <entry> - <indexterm> <primary>round</primary> </indexterm> <literal><function>round(<type>dp</type> or <type>numeric</type>)</function></literal> @@ -865,20 +852,6 @@ <row> <entry> <indexterm> - <primary>setseed</primary> - </indexterm> - <literal><function>setseed(<type>dp</type>)</function></literal> - </entry> - <entry><type>void</type></entry> - <entry>set seed for subsequent <literal>random()</literal> calls (value between -1.0 and - 1.0, inclusive)</entry> - <entry><literal>setseed(0.54823)</literal></entry> - <entry></entry> - </row> - - <row> - <entry> - <indexterm> <primary>sign</primary> </indexterm> <literal><function>sign(<type>dp</type> or <type>numeric</type>)</function></literal> @@ -952,6 +925,56 @@ </table> <para> + <xref linkend="functions-math-random-table"> shows functions for + generating random numbers. + </para> + + <table id="functions-math-random-table"> + <title>Random Functions</title> + + <tgroup cols="3"> + <thead> + <row> + <entry>Function</entry> + <entry>Return Type</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry> + <indexterm> + <primary>random</primary> + </indexterm> + <literal><function>random()</function></literal> + </entry> + <entry><type>dp</type></entry> + <entry>random value in the range 0.0 <= x < 1.0</entry> + </row> + + <row> + <entry> + <indexterm> + <primary>setseed</primary> + </indexterm> + <literal><function>setseed(<type>dp</type>)</function></literal> + </entry> + <entry><type>void</type></entry> + <entry>set seed for subsequent <literal>random()</literal> calls (value between -1.0 and + 1.0, inclusive)</entry> + </row> + </tbody> + </tgroup> + </table> + + <para> + The characteristics of the values returned by + <literal><function>random()</function></literal> depend + on the system implementation. It is not suitable for cryptographic + applications; see <xref linkend="pgcrypto"> module for an alternative. + </para> + + <para> Finally, <xref linkend="functions-math-trig-table"> shows the available trigonometric functions. All trigonometric functions take arguments and return values of type <type>double |