Re: Generating random unique alphanumeric IDs
От | Sam Mason |
---|---|
Тема | Re: Generating random unique alphanumeric IDs |
Дата | |
Msg-id | 20090817005523.GC5407@samason.me.uk обсуждение исходный текст |
Ответ на | Re: Generating random unique alphanumeric IDs (Bob Gobeille <bob.gobeille@hp.com>) |
Список | 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/ [1] http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/
В списке pgsql-general по дате отправления: