MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / FastRandBytes

Function FastRandBytes

base/util_testing.go:939–945  ·  view source on GitHub ↗

FastRandBytes returns a set of random bytes. Uses a low quality random generator.

(t testing.TB, size int)

Source from the content-addressed store, hash-verified

937
938// FastRandBytes returns a set of random bytes. Uses a low quality random generator.
939func 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.
948func MustJSONMarshal(t testing.TB, v interface{}) []byte {

Callers 3

TestWriteJSONPartFunction · 0.92
TestLargeAttachmentsFunction · 0.92
BenchmarkLogRotationFunction · 0.85

Calls 1

ReadMethod · 0.80

Tested by 3

TestWriteJSONPartFunction · 0.74
TestLargeAttachmentsFunction · 0.74
BenchmarkLogRotationFunction · 0.68