Обсуждение: ----??? Random ???

Поиск
Список
Период
Сортировка

----??? Random ???

От
"macky"
Дата:
i want to populate a column with unique random numbers.... is there a
function rhat gives me random unique numbers....??


----------------------------------------------------------------------
The information contained in this message (including any attachments)
is confidential and intended solely for the attention and use of the
named addressee(s). It must not be copied, distributed nor disclosed
to any person. If you are not the intended recipient, please delete
it from your system and notify sender immediately. Any disclosure,
copying or distribution thereof or any action taken or omitted to be
taken in reliance thereon is prohibited and may be unlawful.
----------------------------------------------------------------------



Re: ----??? Random ???

От
Horst Herb
Дата:
On Tuesday 31 July 2001 13:50, you wrote:
> i want to populate a column with unique random numbers.... is there a
> function rhat gives me random unique numbers....??

Yes, Surprisingly ;-) it is called random().

gnumed2=# select random();
      random
-------------------
 0.635214479935921
(1 row)

gnumed2=# create table test(number float);
CREATE
gnumed2=# insert into test values(random());
INSERT 505549 1

Horst


Re: ----??? Random ???

От
Joel Burton
Дата:
On Tue, 31 Jul 2001, macky wrote:

> i want to populate a column with unique random numbers.... is there a
> function rhat gives me random unique numbers....??

Yes. Try

  \df rand

in psql

(find all the functions that start with "rand")

and you'll find it.

--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington