public member function
<random>

std::independent_bits_engine::operator()

result_type operator()();
Generate random number
Returns a new random number.

The engine's transition algorithm invokes the base engines's operator() member as many times as needed to obtain enough significant bits to construct a random value.

The generation algorithm joins the bits obtained above to generate a single value, which is returned by this member function.

Parameters

None

Return value

A new random number.
result_type is a member type, defined as an alias of the type of the numbers generated by the base engine.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// independent_bits_engine::operator()
#include <iostream>
#include <chrono>
#include <random>

int main ()
{
  // obtain a seed from the system clock:
  unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();

  std::independent_bits_engine<std::mt19937,64,std::uint_fast64_t> generator (seed);
  std::cout << "Random value: " << generator() << std::endl;

  return 0;
}

Possible output:
Random value: 7627186886521130655


Complexity

Determined by the base engine.

See also