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; |
(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.
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.
Valor de retorno
Um objeto de
std::vector<double> tipoOriginal:
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.
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