Back to Intelligence
Architecture

The Math of Randomness: Understanding UUID v4 Collision Probability

DSK
Survival Architect
Protocol Architect

With over a decade of experience in browser-native engineering and zero-log architecture, specialized in building secure, high-performance developer utilities. Focused on maintaining data sovereignty and privacy-first protocols for modern software engineering workflows.

2026-03-01
6 min read

The Math of Randomness: Understanding UUID v4 Collision Probability

A UUID (Universally Unique Identifier) is a 128-bit label used for information in computer systems. Version 4 UUIDs are generated using random numbers. But how "unique" are they really?

The Entropy Breakdown

Version 4 UUIDs use 122 bits for randomness. This means there are 2^122 possible combinations. That's a staggering 5,316,911,983,139,663,491,615,228,241,121,373,017,464.

The Birthday Paradox

In probability theory, the birthday paradox concerns the probability that, in a set of n randomly chosen people, some pair of them will have the same birthday. Applying this to UUIDs, even if you generate 1 billion UUIDs every second for the next 100 years, the probability of creating a single duplicate is still mind-boggingly small.

Cryptographic Randomness

To achieve this level of uniqueness in the browser, developers should rely on the crypto.getRandomValues() API rather than Math.random(). The former provides high-entropy, cryptographically strong pseudo-random numbers, whereas the latter is often predictable.