RunningAverage Class on playground (updated)

ANSWER BY ROB TILLAART (send by e-mail):

In the example (of the RunningAverage library) I am clearing the RA variable every 300 count so people see how it can be done and what its effect is on the RA. And that effect is exactly what you see in the RA, the smooth line breaks. The number 300 is just arbitrary.

There can be several reasons why one wants to clear the RA var.
(1) one starts a (really) new series of measurements, Suppose one makes a RA measurement of the light-intensity for one minute once per hour. Then you really want to start clean to make the measurements independent.
(2) when you switch to another range of your input , e.g. you switch the analogReference of a VoltMeter sketch from 5.0 to 1.1Volt.
(3) when you switch the timing between the values, if you have a series with a 1 second interval and you change the interval to 1 minute you must clear the RA otherwise you will compare apples with pears.
(4) when the value measured changes more than a certain value (jumps to another level) one might want to follow immediately.
In the PDF's on the forum post (see link above) there is such a jump around 500 and 900.

That said, in most sketches that run continuously do not need to clear/reset the RA. it can go on and on and on forever.

On the forum there is also the question about fillValue(value, number);
This function can be used to initialize the RA on a certain value with a certain weight,
Example (assume buffersize = 10
if you do a clear() followed by a addValue(100); the RA will be 100. another addValue(50) will set the RA to 75.0.
if you do a fillValue(100, 10), followed by a addValue(100); the RA will be 100, another addValue(50) will set the RA to 95.0,
if you do a fillValue(100, 5), followed by a addValue(100); the RA will be 100, another addValue(50) will set the RA to 92,8571...,

So fillValue has its use especially at the start of a measurement