다음을 통해 공유


piecewise_linear_distribution::piecewise_linear_distribution

분포를 생성합니다.

 // default constructor piecewise_linear_distribution();  // constructs using a range of intervals, [firstI, lastI), with // matching weights starting at firstW template<class InputIteratorI, class InputIteratorW> piecewise_linear_distribution(InputIteratorI firstI, InputIteratorI lastI, InputIteratorW firstW);  // constructs using an initializer list for range of intervals, // with weights generated by function weightfunc template<class UnaryOperation> piecewise_linear_distribution(initializer_list<RealType> intervals, UnaryOperation weightfunc);  // constructs using an initializer list for range of count intervals, // distributed uniformly over [xmin,xmax] with weights generated by function weightfunc template<class UnaryOperation> piecewise_linear_distribution(size_t count, RealType xmin, RealType xmax, UnaryOperation weightfunc);  // constructs from an existing param_type structure explicit piecewise_linear_distribution(const param_type& parm); 

매개 변수

  • firstI
    대상 범위에 있는 첫 번째 요소의 입력 반복기입니다.

  • lastI
    대상 범위에 있는 마지막 요소의 입력 반복기입니다.

  • firstW
    가중치 범위에 있는 첫 번째 요소의 입력 반복기입니다.

  • intervals
    분포의 간격이 있는 initializer_list입니다.

  • count
    분포 범위의 요소 수입니다.

  • xmin
    분포 범위의 가장 작은 값입니다.

  • xmax
    분포 범위의 가장 큰 값입니다. xmin보다 커야 합니다.

  • weightfunc
    분포의 확률 함수를 나타내는 개체입니다. 매개 변수와 반환 값은 둘 다 double로 변환할 수 있어야 합니다.

  • parm
    분포를 생성하는 데 사용되는 매개 변수 구조입니다.

설명

기본 생성자는 저장된 매개 변수를 설정합니다. 따라서 확률 밀도가 1인 0~1 간격이 하나 있습니다.

반복기 범위 생성자

template<class InputIteratorI, class InputIteratorW>
piecewise_linear_distribution(InputIteratorI firstI, InputIteratorI lastI,
        InputIteratorW firstW);

시퀀스 [firstI, lastI)에 대한 반복기의 간격과 firstW에서 시작하는 일치하는 가중치 시퀀스를 사용하여 분포 개체를 생성합니다.

다음 이니셜라이저 목록 생성자는

template<class UnaryOperation>
piecewise_linear_distribution(initializer_list<RealType> intervals, 
        UnaryOperation weightfunc);

이니셜라이저 목록 intervals의 간격과 함수 weightfunc에서 생성된 가중치를 사용하여 분포 개체를 생성합니다.

다음과 같이 정의된 생성자는

template<class UnaryOperation>
piecewise_linear_distribution(size_t count, RealType xmin, RealType xmax,
        UnaryOperation weightfunc);

[xmin,xmax]에 대해 균등하게 배포된 count개 간격을 사용하여 분포 개체를 생성하여 함수 weightfunc에 따라 각 간격 가중치를 할당하고 weightfunc는 매개 변수 하나를 수락해야 하고 반환 값이 있어야 합니다. 이 두 값은 모두 double로 변환할 수 있습니다. 사전 조건: xmin < xmax.

다음과 같이 정의된 생성자는

explicit piecewise_linear_distribution(const param_type& parm);

parm을 사용하여 생성 개체를 저장된 매개 변수 구조로 생성합니다.

요구 사항

헤더: <random>

네임스페이스: std

참고 항목

참조

<random>

piecewise_linear_distribution 클래스