public static member function (公共静态成员函数)
<random>
static constexpr result_type min();
最小值
Returns the minimum value potentially returned by member operator(), which is the same as its base engine's minimum value. (返回成员operator()可能返回的最小值,该值与其基类引擎的最小值相同。)
返回值
base().min() (基类().min())
result_type (结果类型)is a member type, defined as an alias of the type of the numbers generated by the base engine. (是一个成员类型,定义为基类引擎生成的数字类型的别名。)
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// discard_block_engine::min and max
#include <iostream>
#include <chrono>
#include <random>
int main ()
{
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
// ranlux24 is a standard instantitation of discard_block_engine:
std::ranlux24 generator (seed);
std::cout << generator() << " is a random number between ";
std::cout << generator.min() << " and " << generator.max();
return 0;
}
|
可能的输出
471250 is a random number between 0 and 16777215
|