最終更新日時(UTC):
が更新

履歴 編集

function
<random>

std::discrete_distribution::max(C++11)

result_type max() const;

概要

上限を取得する。

戻り値

最大のインデックスである「確率列の要素数 - 1」を返す。

#include <iostream>
#include <random>

int main()
{
  std::discrete_distribution<> dist = {0.1, 0.2, 0.3};

  int max_value = dist.max();
  std::cout << max_value << std::endl;
}

出力

2

バージョン

言語

  • C++11

処理系

参照