Search Postgresql Archives

Re: Generating random unique alphanumeric IDs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

 [1] http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux