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

Function randomBytes

property_test.go:130–137  ·  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

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

Calls

no outgoing calls

Tested by

no test coverage detected