1class SimpleMovingAverage<
Class T>
4 private int m_Pointer = 0;
5 private int m_Size = 0;
17 for (
int i = 0;
i < m_Size;
i++)
20 m_Sum += m_Samples[
i];
35 m_Sum = m_Sum - m_Samples[m_Pointer] +
newSample;
37 if (m_Pointer == m_Size)
40 return m_Sum / m_Size;
Super root of all classes in Enforce script.
T Add(T newSample)
Add new value and return average value from buffer.
void SimpleMovingAverage(int pSize, T pDefaultValue=0)
Initialize Simple Moving Average Cyclic Buffer.