std::discrete_distribution::probabilities

From cppreference.com
Pseudo-random number generation
Uniform random bit generators
Engines and engine adaptors
Non-deterministic generator
Distributions
Uniform distributions
Bernoulli distributions
Poisson distributions
Normal distributions
Sampling distributions
Seed Sequences
(C++11)
C library
std::vector<double> probabilities() const;
(since C++11)

Obtains a std::vector<double> containing the individual probabilities of each integer that is generated by this distribution.

Parameters

(none)

Return value

An object of type std::vector<double>

Example

#include <iostream>
#include <vector>
#include <random>
int main()
{
    std::discrete_distribution<> d({40, 10, 10, 40});
    std::vector<double> p = d.probabilities();
    for(auto n : p)
        std::cout << n << ' ';
    std::cout << '\n';
}

Output:

0.4 0.1 0.1 0.4