22 using jubatus::util::math::random::mtrand;
29 const std::vector<double>& weights, mtrand& rand) {
30 double total_weight = std::accumulate(weights.begin(), weights.end(), 0.0);
31 double x = rand.next_double(total_weight);
34 for (
size_t i = 0; i < weights.size() - 1; ++i) {
40 return weights.size() - 1;
int select_by_weights(const std::vector< double > &weights, mtrand &rand)