From f6d3090f7fa76eb8e0dbe060b8490cb49c001c39 Mon Sep 17 00:00:00 2001 From: nasr Date: Mon, 5 Oct 2026 22:02:56 +0200 Subject: init: base --- source/base/base_rand.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 source/base/base_rand.cpp (limited to 'source/base/base_rand.cpp') diff --git a/source/base/base_rand.cpp b/source/base/base_rand.cpp new file mode 100644 index 0000000..cf8d63a --- /dev/null +++ b/source/base/base_rand.cpp @@ -0,0 +1,19 @@ +#define RAND_CONSTANT 6364136223846793005 +internal u64 rand_u64(u64 constant); + +internal u64 rand_u64(u64 constant) +{ + time_t current_time = time(0); + constant = current_time ^ constant; + + constant += 0x9e3779b97f4a7c15; + + u64 z = constant; + z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9; + z = (z ^ (z >> 27)) * 0x94d049bb133111eb; + z = z ^ (z >> 31); + + return z; +} + +// TODO: bah i don't know if this is good \ No newline at end of file -- cgit v1.3.1