Random.hpp 547 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef CORE_RANDOM_HPP
  2. #define CORE_RANDOM_HPP
  3. #include "core/utils/Types.hpp"
  4. namespace Core {
  5. struct Random final {
  6. using Seed = u32;
  7. private:
  8. constexpr static int N = 25;
  9. constexpr static int M = 7;
  10. Seed data[N];
  11. int index;
  12. public:
  13. Random(Seed seed);
  14. int next();
  15. int next(int min, int inclusiveMax);
  16. bool nextBool();
  17. float nextFloat();
  18. float nextFloat(float min, float exclusiveMax);
  19. private:
  20. void update();
  21. };
  22. }
  23. #endif