Documentation
¶
Overview ¶
Package mathx provides small numeric helpers used by the core components: a deviation-based jitter around a value and a probabilistic boolean.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Unstable ¶
type Unstable struct {
// contains filtered or unexported fields
}
Unstable generates values jittered around a base value by a deviation ratio, used to spread cache expiry so many items do not expire at once.
func NewUnstable ¶
NewUnstable returns an Unstable with the given deviation, clamped to [0, 1].
func (Unstable) AroundDuration ¶
AroundDuration returns a random duration within +/- deviation of base.
Click to show internal directories.
Click to hide internal directories.