公有静态成员函数
<random>

std::shuffle_order_engine::max

static constexpr result_type max();
最大值
返回成员operator()可能返回的最大值,该值与其base引擎的最大值相同。

参数



返回值

base().max()
result_typeis 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
// shuffle_order_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;
}

可能的输出
957132824 is a random number between 1 and 2147483646


复杂度

无 (编译时常量)。

另见