Yjs specifies variable-length unsigned integers as the source for random client-ids. This allows for arbitrary numbers (up to 53 bit currently) to represent client-ids. But you are right, we currently only generate 32 random bits. This has historical reasons because I want to keep compatibility to the 32 bit approach. Soon, I plan to increase that to 53 bit uints once the upgraded library has been rolled out completely.
BigInts might at some point allow us to use arbitrary precision for client-ids. I’m not sure about the performance overhead of using them, but they will allow us to increase entropy even further by using larger numbers.
With 32 bits, the chance of two client-ids colliding is one in 4 billion. If, for any chance, two users get assigned the same client-id, there are mechanisms in place to reassign them once this gets detected. It is generally not a problem if there are two clients with the same id. They just must not create operations concurrently.
Database systems often like to use UUIDv4 which allow 122 bits of entropy. But keep in mind that they assign a random GUID to every single item. Yjs only generates random ids for clients, so we don’t need as much entropy.
Just in case you are developing something like a huge database with Yjs, you can increase that the precision to 64 bit, or even 128 bit. That will be possible with BigInts.