From 38d81760c4d7e22b95252e3545596602c9e38806 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 9 Jan 2023 12:44:00 -0500 Subject: Invent random_normal() to provide normally-distributed random numbers. There is already a version of this in contrib/tablefunc, but it seems sufficiently widely useful to justify having it in core. Paul Ramsey Discussion: https://postgr.es/m/CACowWR0DqHAvOKUCNxTrASFkWsDLqKMd6WiXvVvaWg4pV1BMnQ@mail.gmail.com --- doc/src/sgml/func.sgml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 3bf8d021c3c..b67dc26a353 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1815,6 +1815,28 @@ repeat('Pg', 4) PgPgPgPg + + + + random_normal + + + random_normal ( + mean double precision + , stddev double precision ) + double precision + + + Returns a random value from the normal distribution with the given + parameters; mean defaults to 0.0 + and stddev defaults to 1.0 + + + random_normal(0.0, 1.0) + 0.051285419 + + + @@ -1824,7 +1846,8 @@ repeat('Pg', 4) PgPgPgPg void - Sets the seed for subsequent random() calls; + Sets the seed for subsequent random() and + random_normal() calls; argument must be between -1.0 and 1.0, inclusive @@ -1848,6 +1871,7 @@ repeat('Pg', 4) PgPgPgPg Without any prior setseed() call in the same session, the first random() call obtains a seed from a platform-dependent source of random bits. + These remarks hold equally for random_normal(). -- cgit v1.2.3