public static member function
<random>

std::random_device::max

static constexpr result_type max();
Maximum value
Returns the maximum value potentially returned by member operator(), which for random_device is the same as numeric_limits<unsigned>::max().

Parameters

none

Return value

numeric_limits<unsigned>::max()
result_type is a member type, defined as an alias of unsigned int.

Example

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;
}

Possible output:
default random_device characteristics:
minimum: 0
maximum: 4294967295
entropy: 32
a random number: 4230014324


See also