MCPcopy Create free account
hub / github.com/chainreactors/spray / RandPath

Function RandPath

pkg/utils.go:154–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

152)
153
154func RandPath() string {
155 n := 16
156 b := make([]byte, n)
157 // A rand.Int63() generates 63 random bits, enough for letterIdMax letters!
158 for i, cache, remain := n-1, randInt63(), letterIdMax; i >= 0; {
159 if remain == 0 {
160 cache, remain = randInt63(), letterIdMax
161 }
162 if idx := int(cache & letterIdMask); idx < len(letters) {
163 b[i] = letters[idx]
164 i--
165 }
166 cache >>= letterIdBits
167 remain--
168 }
169 return *(*string)(unsafe.Pointer(&b))
170}
171
172func RandHost() string {
173 n := 8

Callers 2

InitMethod · 0.92
doCheckMethod · 0.92

Calls 1

randInt63Function · 0.85

Tested by

no test coverage detected