generated from Sithas/conan_template
TASK00 - Добавление функции генерации рандомного числа
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <random>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/format.hpp>
|
||||
@@ -115,4 +116,13 @@ std::string ToHex(std::byte* src, size_t len)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t Random()
|
||||
{
|
||||
std::random_device device;
|
||||
std::mt19937 random_generator(device());
|
||||
std::uniform_int_distribution<std::mt19937::result_type> dist(0,UINT64_MAX);
|
||||
|
||||
return dist(random_generator);
|
||||
}
|
||||
} // namespace uad
|
||||
|
||||
Reference in New Issue
Block a user