MCPcopy Index your code
hub / github.com/redpanda-data/console / String

Function String

backend/pkg/random/string.go:37–52  ·  view source on GitHub ↗

String returns a random string made of numbers, upper-, and lower-case letters

(length int)

Source from the content-addressed store, hash-verified

35
36// String returns a random string made of numbers, upper-, and lower-case letters
37func String(length int) string {
38 ar := make([]byte, length)
39 randInts := randCryptoInts(length)
40 alphabetLength := int32(len(alphabet))
41
42 for i := range ar {
43 x := randInts[i]
44 if x < 0 {
45 x = -x
46 }
47 randIndex := x % alphabetLength
48 ar[i] = alphabet[randIndex]
49 }
50
51 return string(ar)
52}

Callers

nothing calls this directly

Calls 1

randCryptoIntsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…