| 79 | } |
| 80 | |
| 81 | void PoissonDistribution :: Rebuild(const int base_interval_time_ms) { |
| 82 | double times_per_ms = (double)1.0 / (double)base_interval_time_ms; |
| 83 | impl_->delay_distribution.reset(new std::exponential_distribution<double>(times_per_ms)); |
| 84 | assert(impl_->delay_distribution != nullptr); |
| 85 | |
| 86 | int seed = std::chrono::system_clock::now().time_since_epoch().count(); |
| 87 | impl_->delay_generator.reset(new std::default_random_engine(seed)); |
| 88 | assert(impl_->delay_generator != nullptr); |
| 89 | } |
| 90 | |
| 91 | const int PoissonDistribution :: GetNextIntervalTimeMs() { |
| 92 |
nothing calls this directly
no outgoing calls
no test coverage detected