std::discrete_distribution::probabilities
Da cppreference.com.
< cpp | numeric | random | discrete distribution
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
std::vector<double> probabilities() const; |
(dal C++11) | |
Ottiene un std::vector<double> contenente le probabilità di ogni singolo numero intero che viene generato da questa distribuzione.
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.
[modifica] Parametri
(Nessuno)
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.
[modifica] Valore di ritorno
Un oggetto di tipo 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.
[modifica] Esempio
#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