random_device::entropy

Estime le caractère aléatoire de la source.

double entropy() const;

Notes

La fonction membre retourne une évaluation de caractères aléatoires de la source, comme mesuré en les bits.(Du développement extrème, une source non aléatoire a une entropie de zéro.)

Exemple

 

// 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); 
    } 
 
  

Configuration requise

en-tête : <random>

l'espace de noms : DST

Voir aussi

Référence

<random>

random_device Class