Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTimer ¶
NewTimer constructs a single-shot time.Timer that, if repeatedly used to construct a series of timers, will ensure that the resulting events conform to the memoryless distribution. For more on how this could and should be used, see the comments to Ticker. It is intended to be a drop-in replacement for time.NewTimer.
Types ¶
type Config ¶
type Config struct {
// Expected records the expected/mean/average amount of time between runs.
Expected time.Duration
// Min provides clamping of the randomly produced value. All timers will wait
// at least Min time.
Min time.Duration
// Max provides clamping of the randomly produced value. All timers will take
// at most Max time.
Max time.Duration
// Once is provided as a helper, because frequently for unit testing and
// integration testing, you only want the "Forever" loop to run once.
//
// The zero value of this struct has Once set to false, which means the value
// only needs to be set explicitly in codepaths where it might be true.
Once bool
}
Click to show internal directories.
Click to hide internal directories.