C++中uniform_int_distribution類的min()方法用於獲取此uniform_int_distribution可以生成的最小可能值。
用法:
result_type min() const;
參數:此方法不接受任何參數。
返回值:此方法在此uniform_int_distribution中返回可能的最小生成值。
例:
// C++ code to demonstrate
// the working of min() function
#include <iostream>
// for uniform_int_distribution function
#include <random>
using namespace std;
int main()
{
int a = 10, b = 100;
// Initializing of uniform_int_distribution class
uniform_int_distribution<int> distribution(a, b);
// Using min()
cout << "Min value that can be generated "
<< "by this uniform_int_distribution:"
<< distribution.min() << endl;
return 0;
}
輸出:
Min value that can be generated by this uniform_int_distribution:10
參考: https://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution/min
相關用法
- C++ std::uniform_int_distribution b()用法及代碼示例
- C++ std::uniform_real_distribution a()用法及代碼示例
- C++ std::uniform_real_distribution min()用法及代碼示例
- C++ std::uniform_real_distribution max()用法及代碼示例
- C++ std::uniform_real_distribution b()用法及代碼示例
- C++ std::uniform_int_distribution a()用法及代碼示例
- C++ std::uniform_int_distribution max()用法及代碼示例
- C++ std::uniform_int_distribution reset()用法及代碼示例
- C++ std::uniform_real_distribution reset()用法及代碼示例
- C++ cin get()用法及代碼示例
- C++ cauchy_distribution a()用法及代碼示例
- C++ std::allocator()用法及代碼示例
- C++ ratio_not_equal()用法及代碼示例
- C++ ratio_equal()用法及代碼示例
- C++ iswprint()用法及代碼示例
注:本文由純淨天空篩選整理自srinam大神的英文原創作品 std::uniform_int_distribution min() method in C++ with examples。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。