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

Function Intn

cryptorand/numbers.go:57–60  ·  view source on GitHub ↗

Intn returns a non-negative integer in [0,maxVal) as an int.

(maxVal int)

Source from the content-addressed store, hash-verified

55
56// Intn returns a non-negative integer in [0,maxVal) as an int.
57func Intn(maxVal int) (int, error) {
58 rng, cs := secureRand()
59 return rng.Intn(maxVal), cs.err
60}
61
62// Float64 returns a random number in [0.0,1.0) as a float64.
63func Float64() (float64, error) {

Callers 15

TestWorkspaceFilterFunction · 0.92
insertRunningFunction · 0.92
genAgentMetricFunction · 0.92
RandomRBACActionFunction · 0.92
randomRBACTypeFunction · 0.92
mustRandInt64nFunction · 0.92
NodesFunction · 0.92
GenerateConfigFunction · 0.92
TestRandErrorFunction · 0.92
TestRandomElementFunction · 0.92

Calls 1

secureRandFunction · 0.85

Tested by 10

TestWorkspaceFilterFunction · 0.74
insertRunningFunction · 0.74
genAgentMetricFunction · 0.74
mustRandInt64nFunction · 0.74
TestRandErrorFunction · 0.74
TestRandomElementFunction · 0.74
TestIntnFunction · 0.74