MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / ReadTestdataBytes

Function ReadTestdataBytes

pkg/util/randutil/rand.go:68–76  ·  view source on GitHub ↗

ReadTestdataBytes reads random bytes, but then nudges them into printable ASCII, *reducing their randomness* to make them a little friendlier for humans using them as testdata.

(r *rand.Rand, arr []byte)

Source from the content-addressed store, hash-verified

66// ASCII, *reducing their randomness* to make them a little friendlier for
67// humans using them as testdata.
68func ReadTestdataBytes(r *rand.Rand, arr []byte) {
69 _, _ = r.Read(arr)
70 for i := range arr {
71 arr[i] = arr[i] & 0x7F // mask out non-ascii
72 if arr[i] < ' ' { // Nudge the control chars up, into the letters.
73 arr[i] += 'A'
74 }
75 }
76}
77
78// SeedForTests seeds the random number generator and prints the seed
79// value used. This value can be specified via an environment variable

Callers

nothing calls this directly

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…