// // Created by baiguwen on 2022/4/24. // #include "white_noise.h" void white_noise::set_config(const nlohmann::json &config) { try { mean_ = jsonValue(config, "WHITE_NOISE_MEAN"); standard_deviation_ = jsonValue(config, "WHITE_NOISE_STDDEV"); normal_distribution_.reset(new std::normal_distribution<>(mean_, standard_deviation_)); config_ = config; } catch (...) { } } nlohmann::json white_noise::config() { return config_; } double white_noise::eval(double value) { if (normal_distribution_) { value = value + normal_distribution_->operator()(mt19937_); } return value; }