From 96326263a2ab99912dbf05f53ca7a4d6bf3e165b Mon Sep 17 00:00:00 2001 From: sillysagiri Date: Wed, 6 Nov 2024 16:40:50 +0700 Subject: [PATCH] remove global random --- src/Panda.hpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Panda.hpp b/src/Panda.hpp index ab33b3f..917d293 100755 --- a/src/Panda.hpp +++ b/src/Panda.hpp @@ -1,9 +1,8 @@ #pragma once +#include #include -#include "utils/Random.hpp" - struct Vector2; struct Color; struct Rectangle; @@ -118,6 +117,19 @@ namespace panda void concat(Matrix m); }; + class Random { + public: + Random(uint64_t seed = 521288629); + void SetSeed(uint64_t seed); + + uint64_t Next(); + double Next_UNI(); + double Range(double min, double max); + + private: + uint64_t s[4]; + }; + class App { public: void CreateWindow(int w, int h, const char *str); @@ -167,9 +179,6 @@ namespace panda // ### texture utils Rectangle GetTextureRect(const Texture &tex, bool flipX, bool flipY); - // Utils - Random &GetDefaultRandom(); - // Euclidean Distance double distance(const Vector2 &p1, const Vector2 &p2); double distanceSqrt(const Vector2 &p1, const Vector2 &p2);