public member function
<random>

std::gamma_distribution::param

(1)
param_type param() const;
(2)
void param (const param_type& parm);
分佈引數
第一個過載 (1) 返回一個包含當前與分佈物件關聯的引數的物件。
第二個過載 (2) 將物件 parm 中的引數關聯到分佈物件。

A gamma_distribution is defined by two parameters: alpha (α) and beta (β). An object of typeparam_typecarries this information, but it is meant to be used only to construct or specify the parameters for a gamma_distribution object, not to inspect the individual parameters.

To inspect the individual parameters associated to the distribution object you can use: gamma_distribution::alpha and gamma_distribution::beta.

引數

parm
An object representing the distribution's parameters, obtained by a call to member function param.
param_type是一個成員型別。

返回值

一個表示分佈引數的物件。
param_type是一個成員型別。

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// gamma_distribution::param
#include <iostream>
#include <random>

int main()
{
  std::default_random_engine generator;
  std::gamma_distribution<double> d1(2.0,2.0);
  std::gamma_distribution<double> d2(d1.param());

  // print two independent values:
  std::cout << d1(generator) << std::endl;
  std::cout << d2(generator) << std::endl;

  return 0;
}

可能的輸出
3.02823
4.66655


複雜度

複雜度不劣於param_type's 建構函式。

另見