MCPcopy
hub / github.com/tailscale/tailscale / RandomDurationBetween

Function RandomDurationBetween

tstime/jitter.go:13–19  ·  view source on GitHub ↗

RandomDurationBetween returns a random duration in range [min,max). If panics if max < min.

(min, max time.Duration)

Source from the content-addressed store, hash-verified

11// RandomDurationBetween returns a random duration in range [min,max).
12// If panics if max < min.
13func RandomDurationBetween(min, max time.Duration) time.Duration {
14 diff := max - min
15 if diff == 0 {
16 return min
17 }
18 return min + rand.N(max-min)
19}

Callers 3

updateEndpointsMethod · 0.92
addrDiscoveryLoopMethod · 0.92

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…