API

Class RollingAverage

RollingAverage

Utility to efficiently compute the rolling average and variance over a sliding window of samples

Index
average: number

Current average

variance: number

Current variance

  • Returns previously added values or null if outside of history or outside the sliding window domain

    Parameters

    • i: number

      Index in history. For example, pass 0 for the most recent value and 1 for the value before that

    Returns number

    Value previously recorded with add() or null if outside of range