def decayingAverage(newVal, oldVal, numSamples):
    """Averages oldVal with newVal over numSamples.

    Introduces newVal into oldVal, decaying oldVal by
    a single sample and introducing newVal by a single sample.

    Args:
        newVal: The new value to average.
        oldVal: The value to decay.
        numSamples: The number of samples to decay over.

    Returns:
        Decayed average.
    """
    newAvg = newVal * (1 / numSamples) + oldVal * \
        ((numSamples - 1) / numSamples)
    return newAvg