6
boost::random::discrete_distribution
을 std::vector<double>
으로 초기화하고 싶습니다.std :: vector를 사용하여 boost :: random :: discrete_distribution을 초기화하는 방법?
double probabilities[] = {
0.5, 0.1, 0.1, 0.1, 0.1, 0.1
};
boost::random::discrete_distribution<> dist(probabilities);
을 한 후 완벽하게 작동합니다
내 문제는 내가 공식 예에서와 같이 배열을 초기화하는 경우이다.
그러나 std::vector
으로 초기화하면 확률 1.0의 요소가 하나만있는 것처럼 동작합니다.
boost::random::discrete_distribution<>
을 벡터로 초기화하는 올바른 방법은 무엇입니까?
이것을 해결하는 방법을 알고 있습니까? [link] (https://stackoverflow.com/questions/48013802/how-to-set-a-vector-of-discrete-distribution-c) 그것은 거의 동일하지만, 분포 벡터를 가지고 있습니다. –