randAlpha
These four functions generate cryptographically secure (uses crypto/rand
)
random strings, but with different base character sets:
randAlphaNum
uses0-9a-zA-Z
randAlpha
usesa-zA-Z
randNumeric
uses0-9
randAscii
uses all printable ASCII characters
Each of them takes one parameter: the integer length of the string.
randNumeric 3
The above will produce a random string with three digits.
Back to top