5
$\begingroup$

I ran uuidgen 10k times and noticed that the 13th digit is always 4. Why is that?

UUIDS from uuidgen

$\endgroup$

2 Answers 2

4
$\begingroup$

You can find a full explanation in the Wikipedia article on UUID.

UUID's come in different versions. The 4 you highlighted indicates version 4 was used where the UUID is created by generating a random number. Other versions use for example the date-time and MAC address of your computer.

When you look further at the first character of the next block you will see it is not very random either: it shows only the characters 8, 9, A and B . This is because the two most significant bits are 01 for the variant of this UUID version.

$\endgroup$
2
$\begingroup$

It's the version number of the UUID type /algorithm. This is a version 4 UUID which means that it's made using an upstream OS random number generator, rather than made from a namespace or network card MAC. It also means that it only has 122 bits of entropy, rather than the 128 you thought it did. That's still 5 undecillion values, but less than you thought.

See the wiki article for more details, especially the version types and other restrictions on the format.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.