If implementation limitations prevent generating nondeterministic random numbers, the implementation may employ a random number engine.
class random_device {
public:
// types
using result_type = unsigned int;
// generator characteristics
static constexpr result_type min() { return numeric_limits<result_type>::min(); }
static constexpr result_type max() { return numeric_limits<result_type>::max(); }
// constructors
explicit random_device(const string& token = implementation-defined);
// generating functions
result_type operator()();
// property functions
double entropy() const noexcept;
// no copy functions
random_device(const random_device& ) = delete;
void operator=(const random_device& ) = delete;
};explicit random_device(const string& token = implementation-defined);
double entropy() const noexcept;
result_type operator()();
The parameter is intended to allow an implementation to differentiate between different sources of randomness.
If a device has n states
whose respective probabilities are
P0,…,Pn−1,
the device entropy S is defined as
S=−∑n−1i=0Pi⋅logPi.