#ifndef OPENMW_TEST_SUITE_DETOURNAVIGATOR_GENERATE_H #define OPENMW_TEST_SUITE_DETOURNAVIGATOR_GENERATE_H #include #include #include #include namespace DetourNavigator { namespace Tests { template inline auto generateValue(T& value, Random& random) -> std::enable_if_t= 2> { using Distribution = std::conditional_t, std::uniform_real_distribution, std::uniform_int_distribution>; Distribution distribution(std::numeric_limits::min(), std::numeric_limits::max()); value = distribution(random); } template inline auto generateValue(T& value, Random& random) -> std::enable_if_t { unsigned short v; generateValue(v, random); value = static_cast(v % 256); } template inline void generateValue(unsigned char& value, Random& random) { unsigned short v; generateValue(v, random); value = static_cast(v % 256); } template inline void generateRange(I begin, I end, Random& random) { std::for_each(begin, end, [&](auto& v) { generateValue(v, random); }); } } } #endif