Documentation ¶
Index ¶
- Constants
- func GenerateRandomBytes(n int) []byte
- func GenerateRandomBytesFromSet(n int, charSet []byte) []byte
- func GenerateRandomBytesSet(lens []int) [][]byte
- func GenerateRandomBytesSetFromSet(lens []int, charSet []byte) [][]byte
- func GenerateRandomString(n int) string
- func GenerateRandomStringFromSet(n int, charSet []byte) string
- func GenerateRandomStringSet(lens []int) []string
- func GenerateRandomStringSetFromSet(lens []int, charSet []byte) []string
Constants ¶
const ( DigitsAndEnglish = `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz` DigitsAndSwedish = `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖabcdefghijklmnopqrstuvwxyzåäö` DigitsAndGerman = `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜẞabcdefghijklmnopqrstuvwxyzäöüß` )
Keep in mind that some symbols take >1 byte and if used to generate random string, the result may not be human-readable.
åäö - this string, for example, takes 6 bytes, not 3. So if you try to take random bytes from here, you will possibly get something like `�å`
Use tools like this one to check https://mothereff.in/byte-counter
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomBytes ¶
GenerateRandomBytes returns a random byte slice of latin symbols and/or numbers.
It is NOT crypto safe and is meant to be used in tests or non-sensitive operations only.
func GenerateRandomBytesSet ¶
GenerateRandomBytesSet returns set of random byte slices of latin symbols and/or numbers.
It is NOT crypto safe and is meant to be used in tests or non-sensitive operations only.
func GenerateRandomString ¶
GenerateRandomString returns a random string of latin symbols and/or numbers.
It is NOT cryptographically secure and is meant to be used in tests or non-sensitive operations only
func GenerateRandomStringFromSet ¶
GenerateRandomStringFromSet returns a random string of symbols you provide in charSet.
It is NOT cryptographically secure and is meant to be used in tests or non-sensitive operations only
func GenerateRandomStringSet ¶
GenerateRandomStringSet returns set of random strings of latin symbols and/or numbers.
It is NOT cryptographically secure and is meant to be used in tests or non-sensitive operations only
func GenerateRandomStringSetFromSet ¶
GenerateRandomStringSetFromSet returns set of random strings made from charSet you provide.
It is NOT cryptographically secure and is meant to be used in tests or non-sensitive operations only
Types ¶
This section is empty.