<random>

public static member function (公共静态成员函数)
<random>

std::random_device::min

static constexpr result_type min();
最小值
Returns the minimum value potentially returned by member operator(), which for random_device is always zero. (返回成员operator()可能返回的最小值,对于random_device总是零。)

参数



返回值


result_type (结果类型)是一个成员类型,定义为unsigned int (无符号整数).

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// random_device example
#include <iostream>
#include <random>

int main ()
{
  std::random_device rd;

  std::cout << "default random_device characteristics:" << std::endl;
  std::cout << "minimum: " << rd.min() << std::endl;
  std::cout << "maximum: " << rd.max() << std::endl;
  std::cout << "entropy: " << rd.entropy() << std::endl;
  std::cout << "a random number: " << rd() << std::endl;

  return 0;
}

可能的输出
default random_device characteristics:
minimum: 0
maximum: 4294967295
entropy: 32
a random number: 1243119146


另见