Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Estimates the randomness of the source.
double entropy() const;
Remarks
The member function returns an estimate of the randomness of the source, as measured in bits. (In the extreme, a non-random source has an entropy of zero.)
Example
// std_tr1__random__random_device_entropy.cpp
// compile with: /EHsc
#include <random>
#include <iostream>
typedef std::random_device Myceng;
int main()
{
Myceng ceng;
Myceng::result_type compval = ceng();
compval = compval; // to quiet "unused" warnings
std::cout << "entropy == " << ceng.entropy() << std::endl;
std::cout << "min == " << ceng.min() << std::endl;
std::cout << "max == " << ceng.max() << std::endl;
std::cout << "a random value == " << ceng() << std::endl;
std::cout << "a random value == " << ceng() << std::endl;
std::cout << "a random value == " << ceng() << std::endl;
return (0);
}
entropy == 0 min == 0 max == 4294967295 a random value == 2439379569 a random value == 2439379569 a random value == 2439379569
Requirements
Header: <random>
Namespace: std