MCPcopy Create free account
hub / github.com/dolthub/doltgresql / randomJSONString

Function randomJSONString

postgres/parser/json/random.go:51–61  ·  view source on GitHub ↗
(rng *rand.Rand)

Source from the content-addressed store, hash-verified

49}
50
51func randomJSONString(rng *rand.Rand) interface{} {
52 if rng.Intn(2) == 0 {
53 return staticStrings[rng.Intn(len(staticStrings))]
54 }
55 result := make([]byte, 0)
56 l := rng.Intn(10) + 3
57 for i := 0; i < l; i++ {
58 result = append(result, byte(rng.Intn(0x7f-0x20)+0x20))
59 }
60 return string(result)
61}
62
63func randomJSONNumber(rng *rand.Rand) interface{} {
64 return json.Number(fmt.Sprintf("%v", rng.ExpFloat64()))

Callers 1

doRandomJSONFunction · 0.85

Calls 1

IntnMethod · 0.65

Tested by

no test coverage detected