MCPcopy Index your code
hub / github.com/coder/coder / randInt

Function randInt

agent/unit/graph_test.go:46–55  ·  view source on GitHub ↗

randInt generates a random integer in the range [0, limit).

(limit int)

Source from the content-addressed store, hash-verified

44
45// randInt generates a random integer in the range [0, limit).
46func randInt(limit int) int {
47 if limit <= 0 {
48 return 0
49 }
50 n, err := cryptorand.Int63n(int64(limit))
51 if err != nil {
52 return 0
53 }
54 return int(n)
55}
56
57// UpdateGoldenFiles indicates golden files should be updated.
58// To update the golden files:

Calls 1

Int63nFunction · 0.92

Tested by

no test coverage detected