0

私は boost_1_31_0 を使用しており、ベータ分布のランダムを作成しようとしています (ベータ (アルファ、ベータ) = ガンマ (アルファ) / (ガンマ (アルファ) + ガンマ (ベータ)) という事実を使用しています) I' mこれを使用して毎回16個の乱数を作成します(以下を参照):問題は、生成された乱数が大数の法則を尊重していないことです:生成された数の平均を計算すると、分布ごとに分布の平均とは異なります配布。多くのディストリビューションに同じエンジンを使用することはできないというのが結論ですか? 私のコードは以下の通りです:

//this engine is created in the top of my code.
boost::mt19937 eng;

//MyVector.size() is equal to 8, this boucle is called 100 000 times

for (int i = 0; i<MyVector.size(); i++)
{
    MyObject seedPtr = MyVector[i];
alpha = m_map_alpha.find(seedPtr)->second ;
boost::gamma_distribution<> gamma_alpha(alpha);
boost::variate_generator< boost::mt19937&,boost::gamma_distribution<>> generator_gamma_alpha(eng, gamma_alpha);
alpha_random = generator_gamma_alpha();
boost::gamma_distribution<> gamma_beta(beta);
boost::variate_generator< boost::mt19937&, boost::gamma_distribution<>> generator_gamma_beta(eng, gamma_beta);
beta_random = generator_gamma_beta();   
random = alpha_random / (alpha_random + beta_random ) ;
pair<myObject, double> graine(seedPtr, random);
mapRandoms.insert(graine);
}
4

0 に答える 0