FastRandBytes returns a set of random bytes. Uses a low quality random generator.
(t testing.TB, size int)
| 937 | |
| 938 | // FastRandBytes returns a set of random bytes. Uses a low quality random generator. |
| 939 | func FastRandBytes(t testing.TB, size int) []byte { |
| 940 | b := make([]byte, size) |
| 941 | // staticcheck wants to use crypto/rand as math/rand is deprecated in go 1.20, but we don't need that for testing |
| 942 | _, err := rand.Read(b) // nolint:staticcheck |
| 943 | require.NoError(t, err) |
| 944 | return b |
| 945 | } |
| 946 | |
| 947 | // MustJSONMarshal marshals the given value to JSON, and errors the test if it can not be turned into json. |
| 948 | func MustJSONMarshal(t testing.TB, v interface{}) []byte { |