Skip to content
Tickers with random jitter
Branch: master
Clone or download
Latest commit 3459bce Sep 30, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Remove .vscode Aug 2, 2018
LICENSE Initial commit Aug 2, 2018 Update Sep 30, 2019
jitter.go Doc fixes Aug 16, 2018
norm.go Fix #2 May 20, 2019
uniform.go Add NonNegative flag to `Uniform` jitter May 20, 2019
univariate.go Fix #2 May 20, 2019


Tickers with random jitter

Godoc Reference Go Report Card

Jitterbug provides functionality similar to time.Ticker, but with a configurable random jitter. Jitterbug is considered stable, and production-ready.


go get -u


Jitterbug is used by instantiating a jitterbug.Ticker with an interval and a jitterbug.Jitter. The former specifies a baseline interval for the ticker, to which a jitter is added by the latter.

package main

import (


func main() {
    t := jitterbug.New(
        time.Millisecond * 300,
        &jitterbug.Norm{ Stdev: time.Millisecond * 100 },

    // jitterbug.Ticker behaves like time.Ticker
    for tick := <- range t.C {

Jitterbug is compatible with the univariate distributions from GoNum. For example:

t := jitterbug.New(
    time.Millisecond * 300,
        Sampler: &distruv.Gamma{
            // Tip: cast time.Duration as float64 when using gonum's distruv
            Alpha: float64(time.Millisecond * 100),
            Beta:  float64(time.Millisecond * 200),

Compatible libraries


If you find this useful please let me know:

Seriously, even if you just used it in your weekend project, I'd like to hear about it :)

You can’t perform that action at this time.