Documentation
¶
Overview ¶
Package id generates random n-digit IDs.
Index ¶
Constants ¶
View Source
const ( AlphanumCaseSensitiveDigits = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ123456789" AlphanumCaseInsensitiveDigits = "ABCDEFGHJKLMNPQRSTUVWXYZ123456789" )
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a randomly created ID string. It is not guaranteed to be unique.
Risk estimation can look like this, assuming six AlphanumCaseInsensitiveDigits and five tries:
33^6 ≈ 10^9 different combinations / 10^6 purchases = 10^-3 risk of individual ID being not unique ^ 5 because we do five tries = 10^-15 risk of none of five IDs being not unique / 10^6 purchases = 10^-9 overall risk of failing
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.