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

Function Bytes

pkg/random/random.go:35–42  ·  view source on GitHub ↗

Bytes generates a random byte slice of length n.

(n int)

Source from the content-addressed store, hash-verified

33
34// Bytes generates a random byte slice of length n.
35func Bytes(n int) []byte {
36 p := make([]byte, n)
37 _, err := rand.Read(p)
38 if err != nil {
39 panic(err)
40 }
41 return p
42}
43
44// String returns a random string of length n, it uses the characters of base64.URLEncoding.
45func String(n int) string {

Callers 14

NewFunction · 0.92
NewFunction · 0.92
randomUpDataPayloadFunction · 0.92
randomUpDataPayloadFunction · 0.92
randomDownDataPayloadFunction · 0.92
NewFunction · 0.92
TestCookiesFunction · 0.92
TestCookieFunction · 0.92
loadKeysMethod · 0.92
start.goFile · 0.92
StringFunction · 0.70

Calls 1

ReadMethod · 0.45

Tested by 6

randomUpDataPayloadFunction · 0.74
TestCookiesFunction · 0.74
TestCookieFunction · 0.74
TestPseudoRandomFunction · 0.56
BenchmarkBytesFunction · 0.56