14static constexpr const char*
const s_chars {
"abcdef"};
25 m_id +=
s_chars[
static_cast<int>(std::floor(rng.
gen<
float>(0.0f, 1.0f) * 6))];
27 for (
auto i = 1; i < 32; i++)
29 const auto random =
static_cast<int>(rng.
gen<
float>(0.0f, 1.0f) * 16);
31 if (i == 8 || i == 12 || i == 16 || i == 20)
36 std::stringstream hex;
37 hex << std::hex << (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random));
45 this->m_id = std::move(g.m_id);
52 this->m_id = std::move(g.m_id);
84 return m_id == rhs.m_id;
89 return !operator==(rhs);
static constexpr const char *const s_chars
Guid.cpp galaxy.
Generates random numbers.
T gen(const T min, const T max) noexcept
Generate a random number of type T.
Contains a 128bit randomly generated GUID, along with helper functions.
bool operator!=(const Guid &rhs) noexcept
Inequality comparison.
Guid & operator=(Guid &&) noexcept
Move assignment operator.
const std::string & to_string() const noexcept
Get the GUID as a string.
~Guid() noexcept
Destructor.
bool operator==(const Guid &rhs) noexcept
Equality comparison.