Diferencia entre revisiones de «cpp/numeric/random/discrete distribution/probabilities»
De cppreference.com
< cpp | numeric | random | discrete distribution
(Translated from the English version using Google Translate) |
m (1 revisión: Translate from the English version) |
Revisión de 11:41 25 oct 2012
std::vector<double> probabilities() const; |
(desde C++11) | |
Obtiene un std::vector<double> que contiene las probabilidades individuales de cada número entero que se generan por esta distribución .
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
(Ninguno)
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
Un 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.
Ejemplo
Ejecuta este código
#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'; }
Salida:
0.4 0.1 0.1 0.4