// // random_impl.h // pokemon // // Created by Sam Jaffe on 12/9/17. // #pragma once #include #include #define IMPLEMENT_DEVICE(X) X(size_t) X(double) X(int32_t) X(uint32_t) #define TRIVIAL_RANDOM_DEVICE(T) \ virtual T apply(Distribution const & dist) { return dist(*this); } namespace engine::random { class Device { public: using result_type = uint32_t; constexpr static result_type min() { return 0; } constexpr static result_type max() { return ~0u; } virtual ~Device() = default; virtual result_type operator()() = 0; private: friend class Random; IMPLEMENT_DEVICE(TRIVIAL_RANDOM_DEVICE) }; } #undef TRIVIAL_RANDOM_DEVICE