3 ms·
I wrote a fairly popular Python library to easily generate short UUIDs (encoded with base57): https://github.com/stochastic-technologies/shortuuid https://gith
by StavrosK 11y ago
I wrote a fairly popular Python library to easily generate short UUIDs (encoded with base57):
https://github.com/stochastic-technologies/shortuuid https://github.com/stochastic-technologies/shortuuid
Since it turned out that most uses didn't actually need a UUID and just needed a random string, I figured I'd maximize the randomness per bit and added a .random() call that returns a short string that is taken from os.urandom().
It would probably be good if you asked yourself whether you actually need a UUID or a random string, and used the right tool for the job. Using a UUID when you want a random string and vice versa leads to these kinds of problems.