public member function
<random>

std::piecewise_constant_distribution::densities

vector<result_type> densities() const;
Densities
Returns a vector with the probability densities of each of the distribution subintervals.

Densities represent the probability of the distribution to produce a number in the subinterval divided by the length of that subinterval.

The sequence of densities depend on the weights specified on construction: Each subinterval is assigned a probability density equal to its weight divided by the sum of all weights and the length of the subinterval.

There is no way to retrieve the specific weights used on construction, but only the densities calculated in this way.

Parameters

none

Return value

A vector with the probabilities of each subinterval.
result_type is a member type, defined as an alias of the first class template parameter (RealType).

Complexity

Constant.

See also