#pragma once #include "compat/integer-types.hpp" #include namespace floormat { struct random_engine { virtual ~random_engine(); virtual std::common_type_t operator()() = 0; template requires (sizeof(T) <= sizeof(std::size_t)) T operator()(T max) { return static_cast(operator()() % static_cast(max)); } template requires (sizeof(T) <= sizeof(std::size_t)) T operator()(T min, T max) { return min + operator()(max-min); } virtual float operator()(float min, float max) = 0; }; [[maybe_unused]] extern random_engine& random; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables) } // namespace floormat