Re: Random not so random - Mailing list pgsql-general

From Jean-Luc Lachance
Subject Re: Random not so random
Date
Msg-id 415D903D.4010203@sympatico.ca
Whole thread Raw
In response to Random not so random  ("Arnau Rebassa" <arebassa@hotmail.com>)
List pgsql-general
Use a SERIAL id on messages, then

Select * from messages
where id = int8( random() * currval({sequence_name}));

Arnau Rebassa wrote:

> Hi everybody,
>
> I'm doing the following query:
>
>   select * from messages order by random() limit 1;
>
> in the table messages I have more than 200 messages and a lot of times,
> the message retrieved is the same. Anybody knows how I could do a more
> "random" random?
>
> Thank you very much
>
> --
> Arnau
>
> _________________________________________________________________
> Consigue aquí las mejores y mas recientes ofertas de trabajo EE.UU.
> http://latino.msn.com/empleos
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

pgsql-general by date:

Previous
From: "Ashok......"
Date:
Subject: Arjunt......
Next
From: Marian POPESCU
Date:
Subject: Re: PostgreSQL 8.0.0 Beta 3 Uploaded