估计数据源的随机性。
double entropy() const;
备注
成员函数在位返回数据源的随机性的估计,如度量。(非常,非源具有随机平均信息量零。)
示例
// 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);
}
要求
标头: <random>
命名空间: std