std::discrete_distribution::probabilities
Aus cppreference.com
< cpp | numeric | random | discrete distribution
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
std::vector<double> probabilities() const; |
(seit C++11) | |
Ruft ein std::vector<double> mit den einzelnen Wahrscheinlichkeiten der einzelnen Zahl, die von dieser Verteilung erzeugt wird .
Original:
Obtains a std::vector<double> containing the individual probabilities of each integer that is generated by this distribution.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Parameter
(None)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Rückgabewert
Ein Objekt vom Typ std::vector<double>
Original:
An object of type std::vector<double>
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Beispiel
#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