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.
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;
}
Random value: 7627186886521130655
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4