3 ms·
UUID 4 also sets 4 bits to fixed values to indicate it's version 4. You can argue whether creating different namespaces between the different methods of creatin
by wongarsu 2y ago
UUID 4 also sets 4 bits to fixed values to indicate it's version 4. You can argue whether creating different namespaces between the different methods of creating UUIDs is useful. But your plain random number generator has only a 1/16 chance of generating a valid UUIDv4. (setting the bits correctly is however trivial if you do want to roll your own uuid generator)
- badindentation 2y agoFrom reading wikipedia it seems it's less than that since the 4th group also uses bit to set the variant. e.g. XXXXXXXX-XXXX-4XXX-[89AB]XXX-XXXXXXXX From looking at all the ones in my system.
- edflsafoiewq 2y agoEach method is designed so two IDs both generated with that method don't collide with each other. Reserving bits for the method avoids the problem of having to also ensure that for all pair-wise combinations of methods, two IDs generated with those methods don't collide. This is also why there is only a finite set of universally agreed upon methods.