MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / String

Function String

pkg/random/random.go:45–48  ·  view source on GitHub ↗

String returns a random string of length n, it uses the characters of base64.URLEncoding.

(n int)

Source from the content-addressed store, hash-verified

43
44// String returns a random string of length n, it uses the characters of base64.URLEncoding.
45func String(n int) string {
46 b := Bytes(n * 6 / 8)
47 return base64.RawURLEncoding.EncodeToString(b)
48}
49
50// Jitter returns a random number around d where p is the maximum percentage of change applied to d.
51// With d=100 and p=0.1, the duration returned will be in [90,110].

Callers 7

HashMethod · 0.92
NewFunction · 0.92
newStateFunction · 0.92
TestPseudoRandomFunction · 0.70
BenchmarkStringFunction · 0.70
index.jsFile · 0.50
index.jsFile · 0.50

Calls 1

BytesFunction · 0.70

Tested by 2

TestPseudoRandomFunction · 0.56
BenchmarkStringFunction · 0.56