std::discrete_distribution::probabilities - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::discrete_distribution::probabilities

From cppreference.com
< cpp‎ | numeric‎ | random‎ | discrete distribution

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.

### [edit] Parameters

(none)

### [edit] Return value

An object of type std::vector<double>

### [edit] Example

Run this code

    #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

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/numeric/random/discrete_distribution/probabilities&oldid=62893"