public member function
<random>
std::random_device::entropydouble entropy() const noexcept;
Return entropy
Returns an entropy estimate for the random numbers returned by operator().The value is expressed on a base-2 scale, with a value between zero and log2(max()+1).
If the library implementation employs a random number engine instead of a real-random number generator, the value returned by this function is always zero.
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: 2755249813
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