function
std::fisher_f_distribution::ã³ã³ã¹ãã©ã¯ã¿(C++11)
explicit fisher_f_distribution(RealType m = 1.0, RealType n = 1.0); // (1)
fisher_f_distribution() : fisher_f_distribution(1.0) {} // (1) C++20
explicit fisher_f_distribution(RealType m, RealType n = 1.0); // (2) C++20
explicit fisher_f_distribution(const param_type& parm); // (3)
æŠèŠ
- (1) : ããã©ã«ãã³ã³ã¹ãã©ã¯ã¿
- C++17ãŸã§ : ãã£ãã·ã£ãŒã®Fååžã®èªç±åºŠ
mãšnãåãåãã³ã³ã¹ãã©ã¯ã¿ã
- C++20 : ãã£ãã·ã£ãŒã®Fååžã®èªç±åºŠ
m = 1.0ãšn = 1.0ãšããŠ(2)ã«å§è²ã
- (2) : ãã£ãã·ã£ãŒã®Fååžã®èªç±åºŠ
mãšnãåãåãã³ã³ã¹ãã©ã¯ã¿ã
- (3) : ãã©ã¡ãŒã¿ãªããžã§ã¯ããåãåãã³ã³ã¹ãã©ã¯ã¿ã
param_typeã¯ããã®ã¯ã©ã¹ã®(1)ã®ã³ã³ã¹ãã©ã¯ã¿ãšåããªãŒããŒããŒããæã¡ããããã®ã³ã³ã¹ãã©ã¯ã¿ã®ãã©ã¡ãŒã¿ãä¿æããŠããããã®ã³ã³ã¹ãã©ã¯ã¿ã§ã¯ãparamãªããžã§ã¯ããæã£ãŠãããã©ã¡ãŒã¿ãããã®ã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ã«è»¢éããã
èŠä»¶
- (2) :
m > 0ãã€n > 0ã§ããããš
äŸ
#include <iostream>
#include <random>
#include <cstdint>
int main()
{
std::random_device seed_gen;
std::uint32_t seed = seed_gen();
std::default_random_engine engine(seed);
// ãã©ã¡ãŒã¿ãåå¥ã«æå®ãã
{
// èªç±åºŠ3ãš4ã§ååžããã
std::fisher_f_distribution<> dist(3.0, 4.0);
for (int i = 0; i < 10; ++i) {
double result = dist(engine);
std::cout << result << std::endl;
}
}
std::cout << std::endl;
// ãã©ã¡ãŒã¿ãæå®ãã
{
using dist_type = std::fisher_f_distribution<>;
// èªç±åºŠ3ãš4ã§ååžããã
dist_type::param_type param(3.0, 4.0);
dist_type dist(param);
for (int i = 0; i < 10; ++i) {
double result = dist(engine);
std::cout << result << std::endl;
}
}
}
åºåäŸ
0.616942
0.262524
0.884393
4.27036
1.56633
1.3275
2.20063
19.6223
2.49439
3.50733
0.637539
4.01248
1.08531
0.176918
1.59421
2.15573
2.42154
0.417621
1.14594
0.720437
ããŒãžã§ã³
èšèª
åŠçç³»
åç
§