Namespaces
Variants

std::discrete_distribution<IntType>:: discrete_distribution

From cppreference.net
discrete_distribution ( ) ;
(1) (C++11부터)
template < class InputIt >
discrete_distribution ( InputIt first, InputIt last ) ;
(2) (C++11부터)
discrete_distribution ( std:: initializer_list < double > weights ) ;
(3) (C++11부터)
template < class UnaryOperation >

discrete_distribution ( std:: size_t count, double xmin, double xmax,

UnaryOperation unary_op ) ;
(4) (C++11부터)
explicit discrete_distribution ( const param_type & params ) ;
(5) (C++11부터)

새로운 분포 객체를 생성합니다.

1) 기본 생성자. 가중치 p = {1 } 하나로 분포를 구성합니다. 이 분포는 항상 0 을 생성합니다.
2) [ first , last ) 범위 내의 가중치로 분포를 구성합니다. first == last 인 경우, 효과는 기본 생성자와 동일합니다.
3) weights 내의 가중치로 분포를 생성합니다. 효과적으로 discrete_distribution ( weights. begin ( ) , weights. end ( ) ) 를 호출합니다.
4) count 개의 가중치로 분포를 생성하며, 각 가중치는 함수 unary_op 을 사용하여 생성됩니다. 각 가중치는 w i = unary_op(xmin + δ(i + 0.5)) 와 같으며, 여기서 δ =
(xmax − xmin)
count
이고 i ∈ {0, ..., count − 1 } 입니다. xmin xmax δ > 0 을 만족해야 합니다. 만약 count == 0 이면, 기본 생성자와 동일한 효과를 가집니다.
5) params 를 분포 매개변수로 사용하여 분포를 생성합니다.

매개변수

first, last - 가중치로 사용할 숫자를 정의하는 요소들의 범위. InputIterator 가 참조하는 요소들의 타입은 double 로 변환 가능해야 함
weights - 가중치를 포함하는 초기화 리스트
unary_op - 적용될 단항 연산 함수 객체

함수의 시그니처는 다음에 해당해야 함:

Ret fun ( const Type & a ) ;

시그니처에 const & 가 필요하지 않음
타입 Type double 타입의 객체가 역참조된 후 Type 으로 암시적으로 변환 가능해야 함. 타입 Ret double 타입의 객체가 역참조된 후 Ret 타입의 값이 할당 가능해야 함 ​

params - 분포 매개변수 집합
타입 요구사항
-
InputIt LegacyInputIterator 의 요구사항을 충족해야 함