23 #include "../security/detail/openssl.hpp" 49 if (RAND_bytes(bytes, size) != 1) {
50 BOOST_THROW_EXCEPTION(std::runtime_error(
"Failed to generate random bytes (error code " +
58 static std::mt19937 rng{std::random_device{}()};
65 static std::uniform_int_distribution<uint32_t> distribution;
72 static std::uniform_int_distribution<uint64_t> distribution;
Copyright (c) 2013-2017 Regents of the University of California.
static std::mt19937 & getRandomGenerator()
uint64_t generateSecureWord64()
Generate a cryptographically secure random integer from the range [0, 2^64)
uint32_t generateWord32()
Generate a non-cryptographically-secure random integer in the range [0, 2^32)
uint32_t generateSecureWord32()
Generate a cryptographically secure random integer from the range [0, 2^32)
uint64_t generateWord64()
Generate a non-cryptographically-secure random integer in the range [0, 2^64)
void generateSecureBytes(uint8_t *bytes, size_t size)
Fill bytes of size with cryptographically secure random bytes.
std::string to_string(const V &v)