MCPcopy
hub / github.com/coder/websocket / Int

Function Int

internal/test/xrand/xrand.go:42–48  ·  view source on GitHub ↗

Int returns a randomly generated integer between [0, max).

(max int)

Source from the content-addressed store, hash-verified

40
41// Int returns a randomly generated integer between [0, max).
42func Int(max int) int {
43 x, err := rand.Int(rand.Reader, big.NewInt(int64(max)))
44 if err != nil {
45 panic(fmt.Sprintf("failed to get random int: %v", err))
46 }
47 return int(x.Int64())
48}
49
50// Base64 returns a randomly generated base64 string of length n.
51func Base64(n int) string {

Callers 5

TestConnFunction · 0.92
assertEchoFunction · 0.92
Test_slidingWindowFunction · 0.92
EchoFunction · 0.92
BoolFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestConnFunction · 0.74
assertEchoFunction · 0.74
Test_slidingWindowFunction · 0.74