MCPcopy Index your code
hub / github.com/tailscale/tailscale / TestRandomDurationBetween

Function TestRandomDurationBetween

tstime/jitter_test.go:11–22  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestRandomDurationBetween(t *testing.T) {
12 if got := RandomDurationBetween(1, 1); got != 1 {
13 t.Errorf("between 1 and 1 = %v; want 1", int64(got))
14 }
15 const min = 1 * time.Second
16 const max = 10 * time.Second
17 for range 500 {
18 if got := RandomDurationBetween(min, max); got < min || got >= max {
19 t.Fatalf("%v (%d) out of range", got, got)
20 }
21 }
22}

Callers

nothing calls this directly

Calls 3

RandomDurationBetweenFunction · 0.85
ErrorfMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…