std::discrete_distribution::probabilities
De cppreference.com
< cpp | numeric | random | discrete distribution
Revisión a fecha de 21:00 2 nov 2012; P12bot (Discusión | contribuciones)
![]() |
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
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