25 #include "../security/detail/openssl.hpp"
27 #include <boost/nondet_random.hpp>
28 #include <boost/random/mersenne_twister.hpp>
29 #include <boost/random/uniform_int_distribution.hpp>
55 if (RAND_bytes(bytes, size) != 1) {
56 BOOST_THROW_EXCEPTION(std::runtime_error(
"Failed to generate random bytes (error code " +
63 static boost::random::mt19937&
66 static boost::random_device randomSeedGenerator;
67 static boost::random::mt19937 gen(randomSeedGenerator);
75 static boost::random::uniform_int_distribution<uint32_t> distribution;
82 static boost::random::uniform_int_distribution<uint64_t> distribution;
Copyright (c) 2013-2016 Regents of the University of California.
uint64_t generateSecureWord64()
Generate a cryptographically secure random integer from the range [0, 2^64)
uint32_t generateWord32()
Generate a cryptographically non-secure random integer from the range [0, 2^32)
uint32_t generateSecureWord32()
Generate a cryptographically secure random integer from the range [0, 2^32)
static boost::random::mt19937 & getRandomGenerator()
uint64_t generateWord64()
Generate a cryptographically non-secure random integer from 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)