31 #ifndef _SCC_CRYPTO_RANDOM_H
32 #define _SCC_CRYPTO_RANDOM_H
37 namespace scc::crypto {
75 static void seed(
const void *,
int len);
77 static void seed(
const std::string& buf)
79 seed((
void*)buf.data(), buf.size());
121 constexpr
int min() {
return 0; }
123 constexpr
int max() {
return UINT_MAX; }
Helper to safely lock the engine.
void lock()
Lock the engine.
void unlock()
Unlock the engine.
The random number generator is initialized with random entropy on first use.
int result_type
Required for UniformRandomBitGenerator interface.
static int64_t rand_int64()
Generate random long word.
static void lock()
Lock the number generator while the opaque reference is in use.
static void random_seed()
Generate a random seed and seed the generator with it.
int operator()()
Required for UniformRandomBitGenerator interface.
static void seed(const void *, int len)
Seed the generator.
static uint32_t rand_uint32()
Generate random word.
constexpr int max()
Required for UniformRandomBitGenerator interface.
constexpr int min()
Required for UniformRandomBitGenerator interface.
static void * ctx()
Opaque reference to the number generator.
static uint64_t rand_uint64()
Generate random long word.
static int32_t rand_int32()
Generate random word.
static void seed(const std::string &buf)
Seed the generator.
static void unlock()
Unlock the number generator.
static void rand_bytes(void *, int len)
Generate random bytes.