문제

Ok, it is possible to give weights/probabilities in boost::random::discrete_distribution.

e.g.

double probabilities[] = { 0.5, 0.1, 0.1, 0.1, 0.1, 0.1 };

boost::random::discrete_distribution<> dist(probabilities);

Question: Once the object dist is constructed

(1)How to change one of the weights e.g. 0.5 to 0.3?

(2) How to reassign all the weights at once?

도움이 되었습니까?

해결책

Create a new distribution object and use that instead.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top