From: Tomas Frydrych (tomasfrydrych_at_yahoo.co.uk)
Date: Tue Jan 27 2004 - 07:37:40 EST
* renamed AD_Document::get/setUUID() to more appropriate 
get/setDocUUID()
* added 
        UT_UUID * AD_Document::getNewUUID()
        UT_uint32  AD_Document::getNewUUID32()
        UT_uint64  AD_Document::getNewUUID64()
The middle one is intended to be used where numerical uid's are 
needed instead of UT_rand() (which I have always voiced concerns 
about, see below) and the old UT_UniqueId class  (which too has 
problems; I will remove the UT_UniqueId class in the foreseeable 
future).
It is perhaps worth noting that the numerical uuid's are hashed 
values of the 128-bit UUID proper, so they are only as unique as the 
hash is collision free. The FNV hash seems to have pretty good 
collision resistance, certainly better than the UT_rand() function.
Just to answer those who feel UT_rand() is good enough to create 
uids, in tests I managed to generate the same random number twice in 
less than 6500 calls to UT_rand() !!!. This simply demonstrates the 
fact that randomness does not imply uniqueness. Running tests on a 
large samples (280,000 uids), I found that the uuid hash has 
collision resistance around 3 times better than the UT_rand() 
function.
Tomas
files: xad_Document.h/cpp, pd_Document.h/ccp, ut_uuid.h/cpp, 
ie_imp/exp_AbiWord_1.cpp
This archive was generated by hypermail 2.1.4 : Tue Jan 27 2004 - 07:40:49 EST