Documentation
¶
Overview ¶
Package randomstring can be used for generating different types of random strings
Index ¶
- func CookieFriendlyBytes(length int) []byte
- func CookieFriendlyString(length int) string
- func CookieFriendlyStringNoAlloc(placeholder []byte)
- func EnglishFrequencyString(length int) string
- func HumanFriendlyEnglishString(length int) string
- func HumanFriendlyString(length int) string
- func PickCons() rune
- func PickLetter() rune
- func PickVowel() rune
- func Seed()
- func String(length int) string
- func StringNoAlloc(placeholder []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CookieFriendlyBytes ¶ added in v1.1.0
CookieFriendlyBytes generates a random, but cookie-friendly, byte slice of the given length.
func CookieFriendlyString ¶
CookieFriendlyString generates a random, but cookie-friendly, string of the given length.
func CookieFriendlyStringNoAlloc ¶ added in v1.2.0
func CookieFriendlyStringNoAlloc(placeholder []byte)
CookieFriendlyStringNoAlloc generates a random, but cookie-friendly, string. The bytes of the string are stored in the given byte slice.
func EnglishFrequencyString ¶
EnglishFrequencyString returns a random string that uses the letter frequency of English, ref: http://pi.math.cornell.edu/~mec/2003-2004/cryptography/subs/frequencies.html
func HumanFriendlyEnglishString ¶
HumanFriendlyEnglishString generates a random, but human-friendly, string of * the given length. It should be possible to read out loud and send in an email * without problems. The string alternates between vowels and consontants. * * The vowels and consontants are wighted by the frequency table
func HumanFriendlyString ¶
HumanFriendlyString generates a random, but human-friendly, string of
- the given length. It should be possible to read out loud and send in an email
- without problems. The string alternates between vowels and consontants. *
- Google Translate believes the output is Samoan. *
- Example output for length 7: rabunor
func PickCons ¶
func PickCons() rune
PickCons will pick a consonant, weighted by the frequency table
func PickLetter ¶
func PickLetter() rune
PickLetter will pick a letter, weighted by the frequency table
func StringNoAlloc ¶ added in v1.2.0
func StringNoAlloc(placeholder []byte)
StringNoAlloc generates a random string in the given byte slice, but does not allocate memory with "make".
Types ¶
This section is empty.