다음을 통해 공유


variate_generator Class

엔진 및 분포를 래핑합니다.

template<class Engine, class Dist>
    class variate_generator {
public:
    typedef Engine engine_type;
    typedef engine-value-type engine_value_type;
    typedef Dist distribution_type;
    typedef typename Dist::result_type result_type;
    variate_generator(engine_type eng0, distribution_type dist0);
    result_type operator()();
    template<class T>
        result_type operator()(T value);
    engine_value_type& engine();
    const engine_value_type& engine() const;
    distribution_type& distribution();
    const distribution_type& distribution() const;
    result_type min() const;
    result_type max() const;
private:
    Engine eng;             // exposition only
    Dist dist;              // exposition only
    };

매개 변수

  • Engine
    임의 엔진의 형식입니다.

  • Dist
    분포의 형식입니다.

설명

엔진 및 분포를 보유 하 고 래핑된 엔진 개체를 전달 하 여 값을 출력 개체를 설명 하는 템플릿 클래스의 distribution 개체의 operator().

템플릿 인수 Engine 형식일 수 Eng, Eng*, 또는 Eng&여기서 Eng 는 엔진입니다.형식 Eng 엔진의 내부 형식입니다.해당 개체는 Eng 되는 내부 엔진 개체.

의해 생성 된 값의 형식과 일치 하는 래핑된 엔진 서식 파일을 사용은 engine 개체 형식에 필요한 값은 distribution 개체.래핑된 엔진의 operator() 형식의 값을 반환 합니다. Dist::input_type는 다음과 같이 생성 된:

경우 Engine::result_type 및 Dist::input_type 모두 정수 계열 형식에 반환 된 eng(), 형식으로 변환 된 Dist::input_type.

경우 Engine::result_type 및 Dist::input_type 모두 부동 소수점 형식에 반환 된 (eng() - eng.min()) / (eng.max() - eng.min()), 형식으로 변환 된 Dist::input_type.

경우 Engine::result_type 정수 계열 형식인 및 Dist::input_type 는 부동 소수점 입력 하면 반환 된 (eng() - eng.min()) / (eng.max() - eng.min() + 1), 형식으로 변환 된 Dist::input_type.

경우 Engine::result_type 부동 소수점 형식인 및 Dist::input_type 정수를 입력 하면 반환 된 ((eng() - eng.min()) / (eng.max() - eng.min()) * std::numeric_limits<Dist::input_type>::max(), 형식으로 변환 된 Dist::input_type.

요구 사항

헤더: <random>

네임 스페이스: std

참고 항목

참조

<random>

variate_generator::distribution

variate_generator::distribution_type

variate_generator::engine

variate_generator::engine_type

variate_generator::engine_value_type

variate_generator::operator()

variate_generator::variate_generator