remove global random

This commit is contained in:
sillysagiri 2024-11-06 16:40:50 +07:00
parent 31adb6cbc9
commit 96326263a2

View File

@ -1,9 +1,8 @@
#pragma once
#include <cstdint>
#include <string>
#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);