std::discrete_distribution::probabilities
De cppreference.com
|
|
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. |
<metanoindex/>
<tbody> </tbody> std::vector<double> probabilities() const; |
(depuis C++11) | |
Obtient un
std::vector<double> contenant les probabilités individuelles de chaque entier qui est généré par cette distribution .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.
Paramètres
(Aucun)
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.
Retourne la valeur
Un objet de
std::vector<double> typeOriginal:
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.
Exemple
#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';
}
Résultat :
0.4 0.1 0.1 0.4