random_device::entropy
評估這個來源的隨機。
double entropy() const;
備註
成員函式以位元組傳回目前來源的隨機性的預估,如測量。(非常,非隨機 Entropy 來源具有零)。
範例
// 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