rename rand.dat -> noise.dat

This commit is contained in:
jacob 2025-01-17 10:16:50 -06:00
parent d78adcb9c9
commit a5111c5b51
2 changed files with 5 additions and 3 deletions

View File

@ -40,9 +40,9 @@ struct rng_startup_receipt rng_startup(struct resource_startup_receipt *resource
{ {
(UNUSED)resource_sr; (UNUSED)resource_sr;
G.arena = arena_alloc(GIGABYTE(64)); G.arena = arena_alloc(GIGABYTE(64));
struct string rand_path = STR("res/rand.dat"); struct string noise_path = STR("res/noise.dat");
if (resource_exists(rand_path)) { if (resource_exists(noise_path)) {
struct resource r = resource_open(rand_path); struct resource r = resource_open(noise_path);
G.noise_count = r.bytes.size / sizeof(*G.noise); G.noise_count = r.bytes.size / sizeof(*G.noise);
G.noise = arena_push_array(&G.arena, u64, G.noise_count); G.noise = arena_push_array(&G.arena, u64, G.noise_count);
MEMCPY(G.noise, r.bytes.data, r.bytes.size); MEMCPY(G.noise, r.bytes.data, r.bytes.size);
@ -84,6 +84,8 @@ f64 rng_rand_f64(f64 range_start, f64 range_end)
/* ========================== * /* ========================== *
* Noise * Noise
* Functions that return a deterministic pre-computed random number based on the provided seed * Functions that return a deterministic pre-computed random number based on the provided seed
*
* NOTE: Noise pattern repeats after period depending on how much noise data exists in noise.dat
* ========================== */ * ========================== */
u32 rng_noise_u32(u32 seed) u32 rng_noise_u32(u32 seed)