<random>

public static member function (公共靜態成員函式)
<random>

std::discard_block_engine::min (std::丟棄塊引擎::最小值)

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


複雜度

無 (編譯時常量)。

另見