|
|
|
@ -2,10 +2,10 @@
|
|
|
|
|
|
|
|
|
|
This repo contains a list of utils that will probably need to be implimented for LLO.
|
|
|
|
|
|
|
|
|
|
* llo::utils::generate_random, generate a random numerical value.
|
|
|
|
|
* llo::utils::generate_random_number, generate a random numerical value.
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
template<typename number_t, typename = typename std::enable_if_t<std::is_arithmetic_v<number_t>, number_t>>
|
|
|
|
|
template<typename number_t, typename = std::enable_if_t<std::is_arithmetic_v<number_t>, number_t>>
|
|
|
|
|
number_t generate_random_number(const number_t minimum, const number_t maximum)
|
|
|
|
|
{
|
|
|
|
|
using uniform_distribution_t = std::conditional_t<std::is_integral_v<number_t>, std::uniform_int_distribution<number_t>, std::uniform_real_distribution<>>;
|
|
|
|
@ -36,7 +36,7 @@ class T hash_t
|
|
|
|
|
public:
|
|
|
|
|
static std::shared_ptr<hash_t> make(const T& data)
|
|
|
|
|
{
|
|
|
|
|
auto hash = std::hash<std::varient<T, std::uint64_t>>{}(data, llo::utils::generate_random<std::uint64_t>());
|
|
|
|
|
auto hash = std::hash<std::varient<T, std::uint64_t>>{}(data, llo::utils::generate_random_number<std::uint64_t>());
|
|
|
|
|
|
|
|
|
|
return std::make_shared<hash_t>(data, hash);
|
|
|
|
|
}
|
|
|
|
|