公有成員函式 (public member function)
<random>
(1) | explicit fisher_f_distribution ( result_type m = 1.0, result_type n = 1.0 ); |
---|
(2) | explicit fisher_f_distribution ( const param_type& parm ); |
---|
構造費舍爾F分佈 (Construct Fisher F-distribution)
引數
- m
- 分佈引數 m,它指定了分子自由度。
該值必須是正數 (m>0)。
result_type是一個成員型別,表示每次呼叫 operator() 時生成的隨機數型別。它被定義為第一個類模板引數的別名 (實數型別 (RealType)).
- n
- 分佈引數 n,它指定了分母自由度。
該值必須是正數 (n>0)。
result_type是一個成員型別,表示每次呼叫 operator() 時生成的隨機數型別。它被定義為第一個類模板引數的別名 (實數型別 (RealType)).
- parm
- 表示分佈引數的物件,透過呼叫成員函式 param 獲取。
param_type是一個成員型別。
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
// fisher_f_distribution example
#include <iostream>
#include <chrono>
#include <random>
int main()
{
// construct a trivial random generator engine from a time-based seed:
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::default_random_engine generator (seed);
std::fisher_f_distribution<double> distribution (2.0,2.0);
std::cout << "some F-distributed(2.0,2.0) results:" << std::endl;
for (int i=0; i<5; ++i)
std::cout << distribution(generator) << std::endl;
return 0;
}
|
可能的輸出
some F-distributed(2.0,2.0) results:
0.226118
0.208781
0.0283665
2.15256
0.37961
|