Re: Random numbers - Mailing list pgsql-general

From bricklen
Subject Re: Random numbers
Date
Msg-id CAGrpgQ8nrrYuZxXn2FpqYdBiq0S3HjhhgCFAYx-p92Wed537pA@mail.gmail.com
Whole thread Raw
In response to Random numbers  (Karel Riveron Escobar <kescobar@estudiantes.uci.cu>)
Responses Re: Random numbers
Re: Random numbers
List pgsql-general

On Sat, May 25, 2013 at 8:45 AM, Karel Riveron Escobar <kescobar@estudiantes.uci.cu> wrote:
I want to generate random numbers in Pl/pgSQL. How can I do this?
To be more specific, I have to generate random numbers among 0 and 5.

One way:
select n from unnest(ARRAY[0,1,2,3,4,5]) n order by random() limit 1;

pgsql-general by date:

Previous
From: Karel Riveron Escobar
Date:
Subject: Random numbers
Next
From: Ian Lawrence Barwick
Date:
Subject: Re: Random numbers