summary refs log tree commit diff
path: root/src/Math/Random.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Math/Random.cpp')
-rw-r--r--src/Math/Random.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/Math/Random.cpp b/src/Math/Random.cpp
index aa0ff55..cf3bbad 100644
--- a/src/Math/Random.cpp
+++ b/src/Math/Random.cpp
@@ -2,10 +2,8 @@
 
 namespace Math::Random {
 
-std::array<uint8_t, 4> break_float(const float f) {
-    static_assert(sizeof(float) == 4);
-
-    union { float f; uint8_t u[4]; } t{};
+std::array<U8, 4> break_float(const F32 f) {
+    union { F32 f; U8 u[4]; } t{};
     t.f = f;
 
     return {
@@ -13,18 +11,18 @@ std::array<uint8_t, 4> break_float(const float f) {
     };
 }
 
-float to_float(uint8_t u) {
-    return (float)u / (float)255;
+F32 to_float(U8 u) {
+    return (F32)u / (F32)255;
 }
 
-uint8_t hash(uint8_t x) {
+U8 hash(U8 x) {
     auto o = (x ^ 0xAA) * 5;
     auto rot = o % 8;
     return o << rot | o >> (8 - rot);
 }
 
-float random() {
-    uint8_t r = std::rand() % 255;
+Real random() {
+    U8 r = std::rand() % 255;
     return to_float(hash(r));
 }