src/particle_filter.cpp
void ParticleFilter::resample() {
  std::discrete_distribution<int> sampler(weights.begin(), weights.end());

  for (auto &particle: particles) {
    size_t idx = sampler(gen);
    particle = particles[idx];
  }
}
/**
 * @brief Resample particles by their weighted index.
 */
@brief Resample particles by their weighted index.
@brief Resample particles by their weighted index .
void ParticleFilter::resample() {
  std::discrete_distribution<int> sampler(weights.begin(), weights.end());
  for (auto &particle: particles) {
    size_t idx = sampler(gen);
    particle = particles[idx];
  }
}
void ParticleFilter :: resample ( ) { std :: discrete_distribution < int > sampler ( weights . begin ( ) , weights . end ( ) ) ; for ( auto & particle : particles ) { size_t idx = sampler ( gen ) ; particle = particles [ idx ] ; } }
@brief Resample particles by their weighted index.
@brief Resample particles by their weighted index .