| 53 | } |
| 54 | |
| 55 | double simulate(InputConfig const& config) { |
| 56 | double updated_price = config.price; |
| 57 | thread_local static std::mt19937 generator(std::random_device{}()); |
| 58 | std::uniform_real_distribution<> dis(-1 * config.deviation, config.deviation); |
| 59 | |
| 60 | for (int j = 0; j < config.iterations; ++j) { |
| 61 | updated_price = |
| 62 | updated_price * (1 + ((config.variance + dis(generator)) * 0.01)); |
| 63 | } |
| 64 | return updated_price; |
| 65 | } |
| 66 | |
| 67 | int main(int argc, char* argv[]) { |
| 68 | if (argc < 2) { |