Hi,

I would like to add a new type of sequence in Tryton that will generate random
but unique number.
A simple solution will be to generate random number and compare it with
already generated number (stored in a table). But there is the birthday
paradox [1] that reduces the speed of this method.

An other way will be to store in a table every possible value (if the length
of the number is fixed) and pick/remove one randomly. But here the generation
of all values can be slow.

Is there anybody that knows a better way?


[1] http://en.wikipedia.org/wiki/Birthday_paradox

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: [email protected]
Jabber: [email protected]
Website: http://www.b2ck.com/
twitter: http://twitter.com/cedrickrier
identi.ca: http://identi.ca/cedrickrier

Attachment: pgpsWLLRTvJgi.pgp
Description: PGP signature

Reply via email to