5

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

UUIDS from uuidgen

mafonya
  • 165
  • 5

2 Answers2

4

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.

Maarten Bodewes
  • 92,551
  • 13
  • 161
  • 313
Jeff
  • 493
  • 3
  • 9
2

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.

Paul Uszak
  • 15,390
  • 2
  • 28
  • 77