aboutsummaryrefslogtreecommitdiff
path: root/src/rand_sys.c
diff options
context:
space:
mode:
authorUneven Prankster <unevenprankster@protonmail.com>2023-10-15 21:28:29 -0300
committerUneven Prankster <unevenprankster@protonmail.com>2023-10-15 21:28:29 -0300
commit1c0cc775732201f4c4d3ee0d6772be786b3b4aa1 (patch)
treef5d692d046868261275c7430a624c3ea9ed75d3d /src/rand_sys.c
parenta89f892640cf12f75c7ce18e6e88c70a8d3965ed (diff)
A lot has certainly happened!
Diffstat (limited to 'src/rand_sys.c')
-rw-r--r--src/rand_sys.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/rand_sys.c b/src/rand_sys.c
deleted file mode 100644
index 679ac94..0000000
--- a/src/rand_sys.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "rand_sys.h"
-
-#define WIN32_LEAN_AND_MEAN
-#define NOSERVICE
-#define NOMCX
-#define NOIME
-#include <windows.h>
-
-static u32 state[2];
-
-void rand_seed(void)
-{
- FILETIME t;
- GetSystemTimeAsFileTime(&t);
-
- u32 val = t.dwLowDateTime;
- val ^= val >> 16;
- val *= 0x85ebca6b;
- val ^= val >> 13;
- val *= 0xc2b2ae35;
- val ^= val >> 16;
-
- state[0] = val;
- state[1] = val ^ 0x49616e42U;
-}
-
-u32 rand_u32(void)
-{
- state[0] = (state[0] << 16) + (state[0] >> 16);
- state[0] += state[1];
- state[1] += state[0];
- return state[0];
-}
-
-i32 rand_range(i32 min, i32 max)
-{
- u32 range = (u32)(max - min + 1);
- u32 num = rand_u32() % range;
-
- return min + (i32)num;
-} \ No newline at end of file