Skip site navigation (1) Skip section navigation (2)

Re: Re: RANDOM function?

From: Einar Karttunen <ekarttun(at)cs(dot)Helsinki(dot)FI>
To: <ghaverla(at)freenet(dot)edmonton(dot)ab(dot)ca>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Re: RANDOM function?
Date: 2001-07-31 13:30:23
Message-ID: Pine.LNX.4.33.0107311627520.20135-100000@melkinpaasi.cs.Helsinki.FI (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Tue, 31 Jul 2001 ghaverla(at)freenet(dot)edmonton(dot)ab(dot)ca wrote:
> I'm sure you can do a search for a RNG without replacement as
> easily as I can.  Yes, a person can always keep track of what
> numbers have already been picked and reject duplicate picks.
> If the number of picks you are making is much smaller than the
> space you are picking from, this would work fine.  Especially
> using a smart (not linear) search for the possible duplicate.
> If the number of picks is getting close to the size of the
> stack, rejection is going to be a big loser.  Any program
> that draws cards from a deck is going to use this type of
> without replacement method, as some card games deal the entire
> deck.
I don't think it is wise to do it externally if you can let the db do it
using unique columns. The method you suggested just sounded new to me,
I would have preferred a hash table or a tree structure.

- Einar Karttunen

In response to

pgsql-novice by date

Next:From: ghaverlaDate: 2001-07-31 13:58:21
Subject: Re: Re: Re: Re: RANDOM function?
Previous:From: Einar KarttunenDate: 2001-07-31 13:27:39
Subject: Re: Re: Re: RANDOM function?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group