OpenVPN 3 Core Library
|
Abstract base class for pseudo random number generators. More...
#include <randapi.hpp>
Public Types | |
typedef RCPtr< WeakRandomAPI > | Ptr |
Smart pointer type for managing the ownership of WeakRandomAPI objects. | |
![]() | |
typedef RCPtr< RandomAPI > | Ptr |
Smart pointer type for managing the ownership of RandomAPI objects. | |
typedef unsigned int | result_type |
![]() | |
typedef RCPtr< RC > | Ptr |
Additional Inherited Members | |
![]() | |
virtual std::string | name () const =0 |
Get the name of the random number generation algorithm. | |
virtual void | rand_bytes (unsigned char *buf, size_t size)=0 |
Fill a buffer with random bytes. | |
virtual bool | rand_bytes_noexcept (unsigned char *buf, size_t size)=0 |
Fill a buffer with random bytes without throwing exceptions. | |
template<typename T > | |
void | rand_fill (T &obj) |
Fill a data object with random bytes. | |
template<typename T > | |
T | rand_get () |
Create a data object filled with random bytes. | |
template<typename T > | |
T | rand_get_positive () |
Create a data object filled with random bytes, always >= 0 for signed types. | |
template<typename T > | |
T | randrange (const T end) |
Return a uniformly distributed random number in the range [0, end) | |
template<typename T > | |
T | randrange (const T start, const T end) |
Return a uniformly distributed random number in the range [start, end]. | |
std::uint32_t | randrange32 (const std::uint32_t end) |
Return a uniformly distributed random number in the range [0, end) | |
std::uint32_t | randrange32 (const std::uint32_t start, const std::uint32_t end) |
Return a uniformly distributed random number in the range [start, end]. | |
std::uint8_t | randbyte () |
Return a random byte. | |
bool | randbool () |
Return a random boolean. | |
result_type | operator() () |
![]() | |
RC () noexcept=default | |
RC (const RC &)=delete | |
virtual | ~RC ()=default |
RC & | operator= (const RC &)=delete |
olong | use_count () const noexcept |
Delegates call to RCImpl and returns the result. | |
![]() | |
static constexpr result_type | min () |
static constexpr result_type | max () |
![]() | |
static constexpr bool | is_thread_safe () |
Delegates call to RCImpl and returns the result. | |
Abstract base class for pseudo random number generators.
Inherit from this class if your random number generator produces pseudo random numbers which are deterministic and should not be used for operations requiring true randomness.
Definition at line 244 of file randapi.hpp.
Smart pointer type for managing the ownership of WeakRandomAPI objects.
Definition at line 251 of file randapi.hpp.