Conversation
…ollision (e.g., date format as '%d')
|
I like the overall idea, and thanks for the great analysis. I would like for a much simpler solution: to increase the default number of random chars so the chance of collision is acceptably low. Your changes to configure the link format are great. In addition to that, a simple: should suffice. Thoughts? Originally posted by @redstreet in #34 (comment) |
|
I would really prefer this solution:
In short, there is no such thing as a collision-free hash. Providing a randomized sequence of strings provides good performance and efficiently uses the available strings. Guaranteeing uniqueness seems like a better practice than hoping for it. |
|
I may be able to simplify my changes with some refactoring. I will leave this PR open to preserve the discussion, but please hold off on merging. |
|
Closing; replacing with refactored #37 |
ue to the "birthday problem," the randomly generated link IDs have an unexpectedly high probability of collisions, exceeding 50% when the transactions per day exceed 255:
These changes use a guaranteed unique random string generator that raises StopIteration when the number of available random strings is exhausted (default: 4097).
These changes also allow configuration of the link format, including changing the number of random characters and changing the date format.