summaryrefslogtreecommitdiff
path: root/source/base/base_rand.cpp
diff options
context:
space:
mode:
authornasr <nsrddyn@gmail.com>2026-10-05 22:02:56 +0200
committernasr <nsrddyn@gmail.com>2026-10-05 22:02:56 +0200
commitf6d3090f7fa76eb8e0dbe060b8490cb49c001c39 (patch)
tree433c773997e51f22738acb8b04c4fd2fc6b1bdc9 /source/base/base_rand.cpp
init: base
Diffstat (limited to 'source/base/base_rand.cpp')
-rw-r--r--source/base/base_rand.cpp19
1 files changed, 19 insertions, 0 deletions
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 @@
1#define RAND_CONSTANT 6364136223846793005
2internal u64 rand_u64(u64 constant);
3
4internal u64 rand_u64(u64 constant)
5{
6 time_t current_time = time(0);
7 constant = current_time ^ constant;
8
9 constant += 0x9e3779b97f4a7c15;
10
11 u64 z = constant;
12 z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;
13 z = (z ^ (z >> 27)) * 0x94d049bb133111eb;
14 z = z ^ (z >> 31);
15
16 return z;
17}
18
19// TODO: bah i don't know if this is good \ No newline at end of file