Help us shape the future of Go! Take the 2026 Go Developer Survey

randomticker

package
v0.112.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RandomTicker

type RandomTicker struct {
	C chan time.Time
	// contains filtered or unexported fields
}

RandomTicker is similar to time.Ticker but ticks at random intervals between the min and max duration values (stored internally as int64 nanosecond counts).

func NewRandomTicker

func NewRandomTicker(minDuration, maxDuration time.Duration) *RandomTicker

NewRandomTicker returns a pointer to an initialized instance of the RandomTicker. Min and max are durations of the shortest and longest allowed ticks. Ticker will run in a goroutine until explicitly stopped.

func (*RandomTicker) Stop

func (rt *RandomTicker) Stop()

Stop terminates the ticker goroutine and closes the C channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL