From 9426047021651d8d7b6595c1377aef1909afcacd Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 7 Aug 2000 00:51:42 +0000 Subject: Clean up bogosities in use of random(3) and srandom(3) --- do not assume that RAND_MAX applies to them, since it doesn't. Instead add a config.h parameter MAX_RANDOM_VALUE. This is currently set at 2^31-1 but could be auto-configured if that ever proves necessary. Also fix some outright bugs like calling srand() where srandom() is appropriate. --- doc/src/sgml/func.sgml | 12 ++++++++++++ doc/src/sgml/ref/set.sgml | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'doc') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 2e7144b147..aa7e2b0989 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -171,6 +171,18 @@ convert floating point to integer integer(2.0) + + random() + float8 + random value in the range 0.0 to 1.0 + random() + + + setseed(float8) + int + set seed for subsequent random() calls + setseed(0.54823) + diff --git a/doc/src/sgml/ref/set.sgml b/doc/src/sgml/ref/set.sgml index 7f36aae9d7..b76570d5de 100644 --- a/doc/src/sgml/ref/set.sgml +++ b/doc/src/sgml/ref/set.sgml @@ -1,5 +1,5 @@ @@ -194,9 +194,9 @@ SET TIME ZONE { 'timezone' | LOCAL The value for the seed to be used by the - random catalog function. Significant + random function. Allowed values are floating point numbers between 0 and 1, which - are then multiplied by RAND_MAX. This product will + are then multiplied by 2^31-1. This product will silently overflow if a number outside the range is used. -- cgit v1.2.1