Re: setseed accepts bad seeds

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: setseed accepts bad seeds
Дата
Msg-id Pine.BSO.4.64.0704111328310.11607@leary.csoft.net
обсуждение исходный текст
Ответ на Re: setseed accepts bad seeds  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: setseed accepts bad seeds  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Wed, 11 Apr 2007, Tom Lane wrote:

> Kris Jurka <books@ejurka.com> writes:
>> Why doesn't setseed complain when given a seed value outside of its
>> expected range?
>
> Why should it complain?  The use of the value is totally unspecified
> anyway.
>

Because the user is likely using it incorrectly.  I'm not sure what you
mean by totally unspecified.  The documentation[1] states:

set seed for subsequent random() calls (value between 0 and 1.0)

When a user calls setseed(5), setseed(500), or setseed(-500) they get the
same seed value each time which is surely not what they intended.  At
minimum I think it should raise a warning.

Also I think that documentation should be corrected to indicate that
vaules -1 to 1 are the correct seed value range or it should it should map
0->1 to the entire seed space, not just half of it as is currently done.
The decision of which change to make is unclear because it's a change to
either the call signature or to the generated values for a given user
supplied seed.

Kris Jurka

[1] http://www.postgresql.org/docs/8.2/static/functions-math.html#FUNCTIONS-MATH-FUNC-TABLE

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: setseed accepts bad seeds
Следующее
От: Tom Lane
Дата:
Сообщение: Re: setseed accepts bad seeds