setseed() doc
setseed() doc
От:
Dennis Bjorklund <db@zigo.dhs.org>
Дата:
The doc doesn't state in what range the argument to setseed() should be.
Some tests suggest that only values in the range -1.0 to 1.0 work as a
seed and values outside of that give the same sequence of random numbers.
I've attached a trivial one line patch (this is the patch list after
all), but feel free to document it in any way that is appropriate.
setseed() also return an integer, but I have no clue of what it is. The
doc doesn't say anything about it.
The doc say that some functions here depend on the libc that is used,
but such things as the range of the argument and what the return value
is should be in the doc, shouldn't it?
/Dennis
Index: doc/src/sgml/func.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/func.sgml,v
retrieving revision 1.332
diff -u -r1.332 func.sgml
--- doc/src/sgml/func.sgml 22 Aug 2006 00:49:19 -0000 1.332
+++ doc/src/sgml/func.sgml 4 Sep 2006 18:18:26 -0000
@@ -795,7 +795,7 @@
setseed(dp)
int
- set seed for subsequent random() calls
+ set seed for subsequent random() calls (value between -1.0 and 1.0)
setseed(0.54823)
1177314959
Re: setseed() doc
От:
Dennis Bjorklund <db@zigo.dhs.org>
Дата:
Tom Lane skrev: >> setseed(dp) >> int >> - set seed for subsequent random() calls >> + set seed for subsequent random() calls (value between -1.0 and 1.0) > > Looking at the code, it would appear that the intended range is 0 to 1. Ok. What about the return value? The doc didn't say anything about it. /Dennis
Re: setseed() doc
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Dennis Bjorklund writes: > setseed(dp) > int > - set seed for subsequent random() calls > + set seed for subsequent random() calls (value between -1.0 and 1.0) Looking at the code, it would appear that the intended range is 0 to 1. regards, tom lane
Re: setseed() doc
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Dennis Bjorklund writes: > What about the return value? The doc didn't say anything about it. AFAICT it's just junk. It happens to be the input times MAX_RANDOM_VALUE, but what use is that? I wonder if we shouldn't change the function to return VOID ... that option wasn't available when it was coded originally, else it'd probably have been done that way. regards, tom lane
Re: setseed() doc
От:
Bruce Momjian <bruce@momjian.us>
Дата:
Tom Lane wrote:
> Dennis Bjorklund writes:
> > setseed(dp)
> > int
> > - set seed for subsequent random() calls
> > + set seed for subsequent random() calls (value between -1.0 and 1.0)
>
> Looking at the code, it would appear that the intended range is 0 to 1.
Docs updated.
--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Index: doc/src/sgml/func.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/func.sgml,v
retrieving revision 1.332
diff -c -c -r1.332 func.sgml
*** doc/src/sgml/func.sgml 22 Aug 2006 00:49:19 -0000 1.332
--- doc/src/sgml/func.sgml 4 Sep 2006 21:45:15 -0000
***************
*** 795,801 ****
setseed(dp)
int
! set seed for subsequent random() calls
setseed(0.54823)
1177314959
--- 795,801 ----
setseed(dp)
int
! set seed for subsequent random() calls (value between 0 and 1.0)
setseed(0.54823)
1177314959
Re: setseed() doc
От:
Neil Conway <neilc@samurai.com>
Дата:
On Mon, 2006-09-04 at 15:19 -0400, Tom Lane wrote: > AFAICT it's just junk. It happens to be the input times > MAX_RANDOM_VALUE, but what use is that? I wonder if we shouldn't > change the function to return VOID I agree. Given how soon we want to get an 8.2 beta out the door, perhaps this change would be best postponed to 8.3 (unless there's another outstanding 8.2 patch that requires initdb?). -Neil
Re: [HACKERS] setseed() doc
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Neil Conway writes: > On Mon, 2006-09-04 at 15:19 -0400, Tom Lane wrote: >> AFAICT it's just junk. It happens to be the input times >> MAX_RANDOM_VALUE, but what use is that? I wonder if we shouldn't >> change the function to return VOID > I agree. Given how soon we want to get an 8.2 beta out the door, perhaps > this change would be best postponed to 8.3 (unless there's another > outstanding 8.2 patch that requires initdb?). Nothing outstanding at the moment. Although this is surely a small change, it's also pretty low-priority, so I'd counsel leaving it for 8.3 rather than trying to cram it in now. We have more important things to be worrying about ... regards, tom lane
Re: [HACKERS] [PATCHES] setseed() doc
От:
Bruce Momjian <bruce@momjian.us>
Дата:
FYI, Neil has corrected this in CVS HEAD. --------------------------------------------------------------------------- Tom Lane wrote: > Neil Conway writes: > > On Mon, 2006-09-04 at 15:19 -0400, Tom Lane wrote: > >> AFAICT it's just junk. It happens to be the input times > >> MAX_RANDOM_VALUE, but what use is that? I wonder if we shouldn't > >> change the function to return VOID > > > I agree. Given how soon we want to get an 8.2 beta out the door, perhaps > > this change would be best postponed to 8.3 (unless there's another > > outstanding 8.2 patch that requires initdb?). > > Nothing outstanding at the moment. > > Although this is surely a small change, it's also pretty low-priority, > so I'd counsel leaving it for 8.3 rather than trying to cram it in now. > We have more important things to be worrying about ... > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org -- Bruce Momjian bruce@momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +