diff options
| author | Julian Hurst <ark@mansus.space> | 2024-09-17 10:44:22 +0200 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2024-09-17 10:44:22 +0200 |
| commit | 3cb80d144f6210a72866057562489c7605a0817e (patch) | |
| tree | 24073ed853ae67ed086d35c0ad959fe8e4c18e5a | |
| parent | 1c5c6457eda1b7e9b6fc5ffee1d7f6539b2a04cb (diff) | |
| download | rng-3cb80d144f6210a72866057562489c7605a0817e.tar.gz | |
Add protection when unable to generate with given params
| -rw-r--r-- | rng.ha | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -34,6 +34,10 @@ export fn main() void = { }; }; + if (nodups && max < nb) { + fmt::fatal("Can't generate the desired number of randoms without duplicates"); + }; + let seed = time::unix(time::now(time::clock::MONOTONIC)); let r = random::init(seed: u32); let rngs: []u32 = []; |
