How UUID v4 Works: Random Bits and Collision Math
Ask how a version 4 UUID works and you'll usually hear that it's random. True, but the interesting part is how random, and what the format actually guarantees. A v4 identifier packs 122 random bits into 36 characters, enough that two machines can mint keys independently for centuries without producing a duplicate. This article breaks down the version and variant bits, walks through a real generated value, puts honest numbers on collision risk, explains when a time-ordered v7 ID fits better, and lists the mistakes that turn a good identifier scheme into a support ticket.