Namespaces
Variants

std:: weibull_distribution

From cppreference.net
헤더 파일에 정의됨 <random>
template < class RealType = double >
class weibull_distribution ;
(C++11 이후)

weibull_distribution RandomNumberDistribution 요구 사항을 충족하며 Weibull 분포 에 따라 난수를 생성합니다:

f(x;a,b) =
a
b


x
b


a-1
exp

-

x
b


a


**참고:** 제시된 내용은 수학 공식과 HTML 태그로 구성되어 있으며, 번역 지침에 따라: - 모든 HTML 태그와 속성은 원본 그대로 유지 - ,
,  태그 내 텍스트는 번역하지 않음 (이 경우 수학 공식에 해당)
- C++ 관련 용어가 없으므로 해당 사항 없음
따라서 번역할 텍스트가 존재하지 않아 원문을 그대로 유지합니다.

a 형상 매개변수 이고, b 척도 매개변수 입니다.

std::weibull_distribution RandomNumberDistribution 요구 사항을 충족합니다.

목차

템플릿 매개변수

RealType - 생성기에 의해 생성되는 결과 타입. 이것이 float , double , 또는 long double 중 하나가 아닐 경우 효과는 정의되지 않습니다.

멤버 타입

멤버 타입 정의
result_type (C++11) RealType
param_type (C++11) 매개변수 집합의 타입, RandomNumberDistribution 참조.

멤버 함수

새로운 분포를 생성합니다
(public member function)
(C++11)
분포의 내부 상태를 재설정합니다
(public member function)
생성
(C++11)
분포에서 다음 난수를 생성합니다
(public member function)
특성
(C++11)
분포 매개변수를 반환합니다
(public member function)
(C++11)
분포 매개변수 객체를 가져오거나 설정합니다
(public member function)
(C++11)
잠재적으로 생성될 수 있는 최소값을 반환합니다
(public member function)
(C++11)
잠재적으로 생성될 수 있는 최대값을 반환합니다
(public member function)

비멤버 함수

(C++11) (C++11) (removed in C++20)
두 분포 객체를 비교
(함수)
의사 난수 분포에 대한 스트림 입출력 수행
(함수 템플릿)

예제

#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <random>
#include <string>
int main()
{
    std::random_device rd;
    std::mt19937 gen(rd());
    std::weibull_distribution<> d;
    std::map<int, int> hist;
    for (int n = 0; n != 10000; ++n)
        ++hist[std::round(d(gen))];
    std::cout << std::fixed << std::setprecision(1) << std::hex;
    for (auto [x, y] : hist)
        std::cout << x << ' ' << std::string(y / 200, '*') << '\n';
}

가능한 출력:

0 *******************
1 *******************
2 ******
3 **
4
5
6
7
8

외부 링크

1. Weisstein, Eric W. "Weibull Distribution." MathWorld — 울프람 웹 리소스에서.
2. Weibull distribution — 위키백과에서.