* Betr.: " [tryton-dev] Adding random unique sequence" (Tue, 29 Dec 2009 18:38:50 +0100):
> I would like to add a new type of sequence in Tryton that will generate random
> but unique number.
For what is it needed?
> 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.
Birthday paradox is strongly related to the limited quantity of available
numbers.
I don't know, for what purpose it is needed. Does it have to be unique for
the machine, for the database, for the server, for universe?
Perhaps it would be possible to use something like the Message-ID for news, that
also has to be unique. Combining a unique part with a random part could save a
lot of overhead.
BTW: As soon as we will have Tryton work as a mail server it would be
desirable to have a (unique) domain anyway.
> 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.
Seems to me like a huge table which is a lot of overhead. And it won't be
random, if you know numbers taken already from this table.
--
Mathias Behrle
MBSolutions
Gilgenmatten 10 A
D-79114 Freiburg
Tel: +49(761)471023
Fax: +49(761)4770816
http://mbsolutions.selfip.biz
UStIdNr: DE 142009020
PGP/GnuPG key availabable from any keyserver, ID: 0x89BCA161
signature.asc
Description: PGP signature
