diff options
| author | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2016-02-01 15:15:13 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@serenitascapital.com> | 2016-02-01 15:15:13 -0500 |
| commit | 37e7d24066bd59c51263b1e045dab1ada4ea4769 (patch) | |
| tree | 66465bf87c24ef7186cc435fb905d3c3a3add8f1 /stratified_sampling.cpp | |
| parent | ca2758864ee33fc7aebbbf65a87bc9074afc4a3b (diff) | |
| download | projet_C++-37e7d24066bd59c51263b1e045dab1ada4ea4769.tar.gz | |
C++11 me voilĂ !
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(); |
