Re: Re: Re: Re: RANDOM function?

Einar Karttunen <ekarttun@cs.helsinki.fi>

From: Einar Karttunen <ekarttun@cs.Helsinki.FI>
To: <ghaverla@freenet.edmonton.ab.ca>
Cc: <pgsql-novice@postgresql.org>
Date: 2001-07-31T14:09:07Z
Lists: pgsql-novice
On Tue, 31 Jul 2001 ghaverla@freenet.edmonton.ab.ca wrote:
>
> The only thing I would add, is your multiplier (2147...) must
> always be big, with respect to how many times you want to draw
> this random number without replacement.  If you were wanting
> to draw 2000000000 random numbers, this method would bog
> down in rejections (insert failures) towards the end.
>
You cannot go higher if you use an int column because it is a signed 32
bit integer. If you need more use bigints. They will suffice. If not
you are screwed anyways because oids don't suffice.

- Einar Karttunen