Calculate and generate random gaussian number.
159{
160 vector<double> FinalData;
161 int CountOfOutliers = 0;
162 double Medians;
163 double Mad;
164 double StandardDeviation;
165 double DataAverage;
166 double DataMedian;
167
168 vector<double> OriginalData =
Data;
169 vector<double> ChangableData = std::move(
Data);
170
172 Medians =
Median(OriginalData);
173
174 for (auto item : OriginalData)
175 {
176 if (item > (3 * Mad) + Medians || item < -(3 * Mad) + Medians)
177 {
178 CountOfOutliers++;
179 }
180 else
181 {
182 FinalData.push_back(item);
183 }
184 }
185
187 DataAverage =
Average(FinalData);
188 DataMedian =
Median(FinalData);
189
190
191
192
193 *AverageOfData = (
UINT64)DataAverage;
194
195
196
197
198
199 *StandardDeviationOfData = (
UINT64)StandardDeviation + 5;
200 *MedianOfData = (
UINT64)DataMedian;
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215}
unsigned __int64 UINT64
Definition BasicTypes.h:21
T CalculateStandardDeviation(const std::vector< T > &v)
get the standard deviation of elements
Definition gaussian-rng.cpp:78
double Median(vector< double > Cases)
get the median of a vector
Definition gaussian-rng.cpp:22
double MedianAbsoluteDeviationTest(vector< double > Data)
get the Median Absolute Deviation (MAD) Test
Definition gaussian-rng.cpp:97
T Average(const vector< T > &vec)
get the average of a vector
Definition gaussian-rng.cpp:53
Start of Optional Data
Definition script_buffer.hex.txt:8