名前空間
変種

std::discrete_distribution<IntType>::probabilities

提供: cppreference.com
< cpp‎ | numeric‎ | random‎ | discrete distribution
2012年11月2日 (金) 21:00時点におけるP12bot (トーク | 投稿記録)による版

 
 
 
擬似乱数生成
一様ランダムビットジェネレータ
エンジンとエンジンアダプタ
非決定的なジェネレータ
分布
一様分布
ベルヌーイ分布
ポアソン分布
正規分布
標本分布
シードシーケンス
(C++11)
C のライブラリ
 
 
std::vector<double> probabilities() const;
(C++11以上)
このディストリビューションによって生成される各整数の個々の確率を含むstd::vector<double>を取得.
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.

パラメータ

(なし)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

値を返します

タイプ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.

#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';
}

出力:

0.4 0.1 0.1 0.4