Condividi tramite


random_device::random_device

Costruisce il motore.

random_device(const std::string& str);

Parametri

  • str
    La stringa di inizializzazione.

Note

Il costruttore inizializza il dispositivo (se necessario) con str.

Esempio

 

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

Requisiti

intestazione: <random>

Spazio dei nomi: deviazione standard

Vedere anche

Riferimenti

<random>

random_device Class