From 57254689f7c4a1eb9a2ef5d030604d4d0c579c9c Mon Sep 17 00:00:00 2001 From: Julian Hurst Date: Tue, 3 Dec 2024 11:04:32 +0100 Subject: Use seed with nanosecond precision instead of second precision --- rng.ha | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rng.ha b/rng.ha index 24e5177..30ac23a 100644 --- a/rng.ha +++ b/rng.ha @@ -43,7 +43,8 @@ export fn main() void = { fmt::fatal("Can't generate the desired number of randoms without duplicates"); }; - const seed = time::unix(time::now(time::clock::MONOTONIC)); + const now = time::now(time::clock::MONOTONIC); + const seed = (now.sec * time::SECOND) + now.nsec; const r = random::init(seed: u32); let rngs: []u32 = []; defer free(rngs); -- cgit v1.2.3