| From: | Sam Mason <sam(at)samason(dot)me(dot)uk> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Generating random unique alphanumeric IDs |
| Date: | 2009-08-17 00:55:23 |
| Message-ID: | 20090817005523.GC5407@samason.me.uk |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Sun, Aug 16, 2009 at 04:53:01PM -0600, Bob Gobeille wrote:
> One way is to use a LFSR (linear feedback shift register function). I
> haven't used one in a long time but I recall generating pseudo random
> numbers that are guaranteed not to repeat after billions of
> iterations. It's very fast as well. Then translate the resulting
> integer into the character sequence of your choosing. Here is a
> reference: http://en.wikipedia.org/wiki/Linear_feedback_shift_register
Not sure if this is very applicable; LFSRs can have a very long period,
or interval before they repeat (i.e. their internal state is the same as
it was before) but individual numbers *will* be repeated.
The performance claims tend only to apply to hardware implementations,
there are much faster pseudo-random number generators available for
software. The fastest one I found recently is a SIMD implementation of
the "Mersenne Twister" called SFMT[1].
--
Sam http://samason.me.uk/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Craig Ringer | 2009-08-17 02:24:55 | Re: Rapid Seek Devices (feature request) |
| Previous Message | Tom Lane | 2009-08-17 00:50:49 | Re: plpgsql function to validate e-mail |