OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::WeakRandomAPI Class Reference

Abstract base class for pseudo random number generators. More...

#include <randapi.hpp>

Inheritance diagram for openvpn::WeakRandomAPI:
[legend]
Collaboration diagram for openvpn::WeakRandomAPI:
[legend]

Public Types

typedef RCPtr< WeakRandomAPIPtr
 Smart pointer type for managing the ownership of WeakRandomAPI objects.
 
- Public Types inherited from openvpn::RandomAPI
typedef RCPtr< RandomAPIPtr
 Smart pointer type for managing the ownership of RandomAPI objects.
 
typedef unsigned int result_type
 
- Public Types inherited from openvpn::RC< thread_unsafe_refcount >
typedef RCPtr< RCPtr
 

Additional Inherited Members

- Public Member Functions inherited from openvpn::RandomAPI
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 >
rand_get ()
 Create a data object filled with random bytes.
 
template<typename T >
rand_get_positive ()
 Create a data object filled with random bytes, always >= 0 for signed types.
 
template<typename T >
randrange (const T end)
 Return a uniformly distributed random number in the range [0, end)
 
template<typename 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() ()
 
- Public Member Functions inherited from openvpn::RC< thread_unsafe_refcount >
 RC () noexcept=default
 
 RC (const RC &)=delete
 
virtual ~RC ()=default
 
RCoperator= (const RC &)=delete
 
olong use_count () const noexcept
 Delegates call to RCImpl and returns the result.
 
- Static Public Member Functions inherited from openvpn::RandomAPI
static constexpr result_type min ()
 
static constexpr result_type max ()
 
- Static Public Member Functions inherited from openvpn::RC< thread_unsafe_refcount >
static constexpr bool is_thread_safe ()
 Delegates call to RCImpl and returns the result.
 

Detailed Description

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.

Member Typedef Documentation

◆ Ptr

Smart pointer type for managing the ownership of WeakRandomAPI objects.

Definition at line 251 of file randapi.hpp.


The documentation for this class was generated from the following file: