The cuid2 project claims that the purpose of adding in these “other sources” of entropy is to provide robustness against weak entropy sources on the client in the browser. I don’t think this is a problem anymore, but it seems like at one time it was hard to get good random numbers in JS and it was causing UUID collisions. Fair enough.
Your library, however, is written in Elixir and runs on the server. We do not have this weak entropy problem; :crypto.strong_rand_bytes/1 generates crypto-safe random bytes. You can use it to generate unique ids, tokens, etc without worry. For example, phx.gen.auth generates session tokens this way. It is very important that those session tokens cannot be guessed!
For your library, you do not need to follow their generation method because it is totally unnecessary when we already have a good entropy source. The algorithm you’ve implemented, with counters and such, is not adding any entropy to the ids. A counter is a terrible source of entropy.
And please don’t worry about your English, it’s fine. The problem with using something like ChatGPT is that it seems to generate lies much faster than I, a human, can correct them ![]()






















