add in xorshift rand function. begin reworking job queue to use cell entry pointers instead of just cells so results can be posted directly to the relevant entry

This commit is contained in:
2025-08-16 00:41:28 -05:00
parent edda3761d1
commit 3265f045d1
3 changed files with 52 additions and 27 deletions

18
inc/rand.h Normal file
View File

@@ -0,0 +1,18 @@
// TODO: This file needs a serious audit
#include <cstdint>
constexpr uint64_t half_max = UINT64_MAX / 2;
// From https://en.wikipedia.org/wiki/Xorshift
inline void xorshift64(uint64_t &state) {
state ^= state << 13;
state ^= state >> 7;
state ^= state << 17;
}
// returns a random value between -1 and 1. modifies seed
inline float norm_rand(uint64_t &state) {
xorshift64(state);
return (state - half_max) / half_max;
}