#include "Random.hpp" namespace Math::Random { std::array break_float(const float f) { static_assert(sizeof(float) == 4); union { float f; uint8_t u[4]; } t{}; t.f = f; return { t.u[0], t.u[1], t.u[2], t.u[3] }; } float to_float(uint8_t u) { return (float)u / (float)255; } uint8_t hash(uint8_t x) { auto o = (x ^ 0xAA) * 5; auto rot = o % 8; return o << rot | o >> (8 - rot); } float random() { uint8_t r = std::rand() % 255; return to_float(hash(r)); } }