diff options
| author | Julian Hurst <ark@mansus.space> | 2024-12-03 11:04:32 +0100 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2024-12-03 11:05:16 +0100 |
| commit | 57254689f7c4a1eb9a2ef5d030604d4d0c579c9c (patch) | |
| tree | 16dfaea968ae5b5b85b98ac22d04afbd0e7e6d7f | |
| parent | 06489df37cf2d15385eac3cdcc8e18330f3b714b (diff) | |
| download | rng-57254689f7c4a1eb9a2ef5d030604d4d0c579c9c.tar.gz | |
Use seed with nanosecond precision instead of second precision
| -rw-r--r-- | rng.ha | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |
