diff --git a/EnvTest/src/Modell/rejection_sampling/impl.cpp b/EnvTest/src/Modell/rejection_sampling/impl.cpp index 86f6ac7..a0cfe2e 100644 --- a/EnvTest/src/Modell/rejection_sampling/impl.cpp +++ b/EnvTest/src/Modell/rejection_sampling/impl.cpp @@ -18,7 +18,7 @@ void rejection_sampler::setModell(imperfect_virtualage_likelihood modell) std::vector rejection_sampler::solve(simulation_params param) { - std::random_device gen; + std::default_random_engine gen; auto U = std::bind(std::uniform_real_distribution(0., 1.),gen); auto i = param.sample_size; L_.set_data(failures_); @@ -74,3 +74,12 @@ std::vector rejection_sampler::estimate_result_() std::for_each(avg.begin(), avg.end(), [accepted_number](double& param) {param = param / double(accepted_number); }); return avg; } + +void rejection_sampler::oversample(const unsigned int rate) +{ + for (auto outer_incrementer = raw_result_.size()-1;outer_incrementer --> 0;) + { + for (auto i = rate; i-- > 0;) + raw_result_.push_back(raw_result_[outer_incrementer]); + } +} diff --git a/EnvTest/src/Modell/rejection_sampling/impl.h b/EnvTest/src/Modell/rejection_sampling/impl.h index 3a84107..91968cb 100644 --- a/EnvTest/src/Modell/rejection_sampling/impl.h +++ b/EnvTest/src/Modell/rejection_sampling/impl.h @@ -30,4 +30,5 @@ class rejection_sampler //implement modell here std::vector raw_result_; std::vector estimate_result_(); + void oversample(const unsigned int rate); }; \ No newline at end of file