diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-05-06 22:36:33 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-05-06 22:36:33 -0400 |
| commit | a90c62e4359be9b334772ab9c1869cac94d9b2c7 (patch) | |
| tree | 239458a17c833bfdb2dc91f8568d8026746a0a47 /src | |
| parent | aaa68bd1d48087e6e180bbe6563c5aa280ae5e34 (diff) | |
Check getrandom return value
Diffstat (limited to 'src')
| -rw-r--r-- | src/stdlib/random.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdlib/random.h b/src/stdlib/random.h index 861fab56..7311d695 100644 --- a/src/stdlib/random.h +++ b/src/stdlib/random.h @@ -17,7 +17,7 @@ static int64_t random_range(int64_t low, int64_t high) { uint64_t min_r = -range % range; uint64_t r; do { - getrandom(&r, sizeof(r), 0); + assert(getrandom(&r, sizeof(r), 0) == sizeof(r)); } while (r < min_r); return (int64_t)((uint64_t)low + (r % range)); } |
