How to initialize boost::random::discrete_distribution using std::vector?

后端 未结 1 534
广开言路
广开言路 2021-01-05 15:56

I would like to initialize boost::random::discrete_distribution with an std::vector.

My problem is that if I initialize it w

相关标签:
1条回答
  • 2021-01-05 16:44

    The class seems to have a constructor that takes an iterator range. This would be used with a vector like this:

    std::vector<double> probs = ...;
    boost::random::discrete_distribution<> dist(probs.begin(), probs.end());
    
    0 讨论(0)
提交回复
热议问题