std::discrete_distribution::probabilities
Da 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; | (desde C++11) | |
Obtém-se uma std::vector<double> contendo as probabilidades individuais de cada um número inteiro que é gerada por esta distribuição.
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.
[editar]Parâmetros
(Nenhum)
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.
[editar]Valor de retorno
Um objeto de std::vector<double> tipo
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.
[editar]Exemplo
#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';}
Saída:
0.4 0.1 0.1 0.4