On 29/12/09 19:29 +0100, Mathias Behrle wrote:
> * 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. 

We can use UUID like it is already done in calendar modules.
And normally, Tryton will not need to generate Message-ID as it is not
intended to be a MTA.

> 
> > 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.

The randomness is for external people as I explain on previous email.

-- 
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: pgpn1PLbIvFk9.pgp
Description: PGP signature

Reply via email to