diff options
Diffstat (limited to 'stratified_sampling.cpp')
| -rw-r--r-- | stratified_sampling.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/stratified_sampling.cpp b/stratified_sampling.cpp index 22bdbf5..f6c3ff1 100644 --- a/stratified_sampling.cpp +++ b/stratified_sampling.cpp @@ -26,9 +26,9 @@ double quantile_truncate_normal (int i, int n, double mu, std::pair<double, double> mean_var( std::vector<double> r){ std::pair<double, double> p; - for(int i=0; i<r.size(); i++){ - p.first += r[i]; - p.second += r[i]*r[i]; + for(auto &x: r){ + p.first += x; + p.second += x*x; } p.first /= r.size(); p.second /= r.size(); |
