randomBytes returns arbitrary (usually non-JSON) bytes from a seeded RNG.
(r *mathrand.Rand, max int)
| 128 | |
| 129 | // randomBytes returns arbitrary (usually non-JSON) bytes from a seeded RNG. |
| 130 | func 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. |
| 140 | func recoverNoPanic(fn func()) (ok bool) { |
no outgoing calls
no test coverage detected