mal-packet-weaver
C++20 packet serialization/deserialization library.
Loading...
Searching...
No Matches
mal_toolkit::uuid::UUIDGenerator< RNG > Class Template Reference

Generates UUIDv4 from a provided random generator (c++11 random module). std::mt19937_64 is highly recommended as it has a SIMD implementation that makes it very fast and it produces high quality randomness. More...

#include "uuid.hpp"

Collaboration diagram for mal_toolkit::uuid::UUIDGenerator< RNG >:
[legend]

Public Member Functions

 UUIDGenerator ()
 Default constructor.
 
 UUIDGenerator (uint64_t seed)
 Constructor with a specified seed for the random generator.
 
 UUIDGenerator (RNG &gen)
 Constructor with a user-provided random generator.
 
UUID getUUID ()
 Generates a new UUID.
 

Private Attributes

std::shared_ptr< RNG > generator
 
std::uniform_int_distribution< uint64_t > distribution
 

Detailed Description

template<typename RNG>
class mal_toolkit::uuid::UUIDGenerator< RNG >

Generates UUIDv4 from a provided random generator (c++11 random module). std::mt19937_64 is highly recommended as it has a SIMD implementation that makes it very fast and it produces high quality randomness.

Definition at line 269 of file uuid.hpp.

Constructor & Destructor Documentation

◆ UUIDGenerator() [1/3]

template<typename RNG >
mal_toolkit::uuid::UUIDGenerator< RNG >::UUIDGenerator ( )
inline

Default constructor.

Definition at line 275 of file uuid.hpp.

◆ UUIDGenerator() [2/3]

template<typename RNG >
mal_toolkit::uuid::UUIDGenerator< RNG >::UUIDGenerator ( uint64_t seed)
inline

Constructor with a specified seed for the random generator.

Definition at line 284 of file uuid.hpp.

◆ UUIDGenerator() [3/3]

template<typename RNG >
mal_toolkit::uuid::UUIDGenerator< RNG >::UUIDGenerator ( RNG & gen)
inline

Constructor with a user-provided random generator.

Definition at line 293 of file uuid.hpp.

Member Function Documentation

◆ getUUID()

template<typename RNG >
UUID mal_toolkit::uuid::UUIDGenerator< RNG >::getUUID ( )
inline

Generates a new UUID.

Definition at line 301 of file uuid.hpp.

Member Data Documentation

◆ distribution

template<typename RNG >
std::uniform_int_distribution<uint64_t> mal_toolkit::uuid::UUIDGenerator< RNG >::distribution
private

Definition at line 314 of file uuid.hpp.

◆ generator

template<typename RNG >
std::shared_ptr<RNG> mal_toolkit::uuid::UUIDGenerator< RNG >::generator
private

Definition at line 313 of file uuid.hpp.


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