id summary reporter owner description type status milestone component version severity resolution keywords cc 6022 WeightType is misleading in boost::random::discrete_distribution Tim White No-Maintainer "The class template `boost::random::discrete_distribution` is parameterized by types `IntType` (defaulting to `int`) and `WeightType` (defaulting to `double`). Could you please update the documentation to clarify that `WeightType` must be a floating-point type? Alternatively, if the implementation could be changed to allow integer `WeightType`s that would be even better! (But I imagine that could be a lot of work.) A bit more background: The documentation doesn't give any constraints on `WeightType`, and in fact the documentation for one of the constructors gives as an example {{{ discrete_distribution<> dist{1, 4, 5}; }}} which indicates that weights don't have to sum to 1, and hints at the possibility of using an integer `WeightType` -- which would often be convenient and efficient. However, the following snippet fails compilation: {{{ #include void f() { int w[] = {1, 4, 5}; boost::random::discrete_distribution dist(w, w + 3); } }}} Changing the `` to `` or just `` enables compilation. (Also, looking at the Boost implementation, I see a call to an internal `normalize()` method that divides all weights by their sum, so it looks like support for integer `WeightType`s was never intended.) Thanks, Tim " Bugs closed To Be Determined random Boost 1.47.0 Problem fixed