다음을 통해 공유


variate_generator::distribution

겹쳐진된 분포를 반환합니다.

distribution_type& distribution();
const distribution_type& distribution() const;

설명

멤버 함수 저장된 메일 개체에 대 한 참조를 반환 합니다. dist.

예제

 

// std_tr1__random__variate_generator_distribution.cpp 
// compile with: /EHsc 
#include <random> 
#include <iostream> 
 
typedef std::minstd_rand Myeng; 
typedef std::uniform_int<unsigned int> Mydist; 
typedef std::variate_generator<Myeng, Mydist> Myceng; 
int main() 
    { 
    Myeng eng0; 
    Mydist dist0; 
    Myceng ceng(eng0, dist0); 
    const Myceng::engine_type& eng = ceng.engine(); // get base engine 
    const Myceng::distribution_type& dist = 
        ceng.distribution(); // get distribution 
    Myceng::result_type compval = ceng(); 
 
    compval = compval;  // to quiet "unused" warnings 
    eng.min(); 
    dist.min(); 
 
    std::cout << "min == " << ceng.min() << std::endl; 
    std::cout << "max == " << ceng.max() << std::endl; 
 
    std::cout << "a random value == " << ceng() << std::endl; 
    std::cout << "a random value == " << ceng() << std::endl; 
    std::cout << "a random value == " << ceng() << std::endl; 
 
    return (0); 
    } 
 
  

요구 사항

헤더: <random>

네임 스페이스: std

참고 항목

참조

<random>

variate_generator Class