About the uuid generator
A UUID is a 128-bit identifier you can generate anywhere without coordinating with anything else, and be confident it will not collide. That property is the whole reason they exist: two services, two machines or two offline clients can all mint identifiers at once and never have to ask each other for permission.
Version 4 is 122 random bits, and it is what you want almost always. The collision arithmetic is genuinely reassuring — you would need to generate around 2.7 quintillion of them before a duplicate became likely at even a one-in-a-billion chance. For an application identifier, that risk is not the one worth worrying about.
Version 7 exists for one specific problem: v4 as a database primary key. Random keys scatter inserts across the whole index, which fragments it and makes every write touch a different page. A v7 identifier puts a millisecond timestamp in its first 48 bits, so values sort by creation time and inserts land at the end of the tree. If you are choosing a key type for a new table, this is usually the better default.
Every value here is drawn from crypto.getRandomValues, the browser's cryptographic random source, and never from Math.random — which is fast, seeded predictably, and must never generate an identifier anything depends on. The generation happens in your tab, so no server has seen the identifiers you are about to use.
The nil UUID is included because it is a real value with a real meaning: all zeroes, representing the absence of an identifier. It is a placeholder, not something to generate for use.