| 123456789101112131415161718192021222324252627282930313233 |
- //
- // random_impl.h
- // pokemon
- //
- // Created by Sam Jaffe on 12/9/17.
- //
- #pragma once
- #include <random/distribution.h>
- #include <random/forwards.h>
- #define APPLY_DEVICE(T) \
- virtual T apply(Distribution<T> 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;
- APPLY_DEVICE(size_t)
- APPLY_DEVICE(double)
- APPLY_DEVICE(int32_t)
- APPLY_DEVICE(uint32_t)
- };
- }
|