Documentation ¶
Overview ¶
Package random provides utilities and functions for generating random data.
Index ¶
Constants ¶
const ( Digits = "0123456789" UpperLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" LowerLetters = "abcdefghijklmnopqrstuvwxyz" SpecialChars = "<>[]{}()-_*%&/?\"'\\" )
Character sets that you can use when passing into String
Variables ¶
var Base62Chars = Digits + UpperLetters + LowerLetters
Base62Chars is set of Base64 charsets
Functions ¶
func String ¶
String generates a random string of length strLength, composing only of characters in allowedChars. Based on code here: http://stackoverflow.com/a/9543797/483528 For convenience, the random package exposes various character sets you can use for the allowedChars parameter. Here are a few examples:
// Only lower case chars + digits random.String(6, random.Digits + random.LowerLetters)
// alphanumerics + special chars random.String(6, random.Base62Chars + random.SpecialChars)
// Only alphanumerics (base62) random.String(6, random.Base62Chars)
// Only abc random.String(6, "abc")
Types ¶
This section is empty.