MCPcopy Create free account
hub / github.com/buger/jsonparser / randomBytes

Function randomBytes

property_test.go:131–138  ·  view source on GitHub ↗

randomBytes returns arbitrary (usually non-JSON) bytes from a seeded RNG.

(r *mathrand.Rand, max int)

Source from the content-addressed store, hash-verified

129
130// randomBytes returns arbitrary (usually non-JSON) bytes from a seeded RNG.
131func randomBytes(r *mathrand.Rand, max int) []byte {
132 n := r.Intn(max + 1)
133 b := make([]byte, n)
134 for i := range b {
135 b[i] = byte(r.Intn(256))
136 }
137 return b
138}
139
140// recoverNoPanic runs fn and reports whether it returned without panicking.
141func recoverNoPanic(fn func()) (ok bool) {

Calls

no outgoing calls

Tested by

no test coverage detected