MCPcopy
hub / github.com/grpc/grpc-go / chooseRandom

Method chooseRandom

benchmark/stats/curve.go:72–78  ·  view source on GitHub ↗

chooseRandom picks a payload size (in bytes) for a particular range. This is done with a uniform distribution.

()

Source from the content-addressed store, hash-verified

70// chooseRandom picks a payload size (in bytes) for a particular range. This is
71// done with a uniform distribution.
72func (pcr *payloadCurveRange) chooseRandom() int {
73 if pcr.from == pcr.to { // fast path
74 return int(pcr.from)
75 }
76
77 return int(rand.Int32N(pcr.to-pcr.from+1) + pcr.from)
78}
79
80// sha256file is a helper function that returns a hex string matching the
81// SHA-256 sum of the input file.

Callers 1

ChooseRandomMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected