GenerateRandomString generates a random string with the given length based on the chars provided. You can use `PasswordChars` or `AlphaNumChars` constants, or even any other string. Chars from the provided string will be picked uniformly. The provided constants have unique chars, which means that a
(chars string, length int)
| 31 | // You can use your own strings to change that probability. For example, using |
| 32 | // "AAAB" you'll have a 75% of probability of getting "A" and 25% of "B" |
| 33 | func GenerateRandomString(chars string, length int) (string, error) { |
| 34 | return generateString(chars, length) |
| 35 | } |
| 36 | |
| 37 | func generateString(chars string, length int) (string, error) { |
| 38 | ret := make([]byte, length) |
nothing calls this directly
no test coverage detected