MCPcopy Index your code
hub / github.com/opencloud-eu/opencloud / GenerateRandomString

Function GenerateRandomString

pkg/generators/password.go:33–35  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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"
33func GenerateRandomString(chars string, length int) (string, error) {
34 return generateString(chars, length)
35}
36
37func generateString(chars string, length int) (string, error) {
38 ret := make([]byte, length)

Callers

nothing calls this directly

Calls 1

generateStringFunction · 0.85

Tested by

no test coverage detected