lundi 23 février 2015

Xor of random numbers or UUID

I'm developing data structure where each entity should have unique identifier. I'm thinking about using 64 bit random numbers or Boost UUID http://ift.tt/1zbJprd for this.


If I do copying of some entities I need to generate for copies new UUIDs (because otherwise some entities will have duplicate UUIDs). But updating UUIDs requires updating links between entities. So I'm thinking about uniform change to all UUID's: before copying of entities I will generate some LoadingUUID and update all UUIDs using formula:



NewEntityID = EntityID xor LoadingUUID


The question is: will xor of two UUIDs substantially increase probability of clashing UUIDs?





Aucun commentaire:

Enregistrer un commentaire