From c33c85933155d0fb6c825399545f1327306c1af4 Mon Sep 17 00:00:00 2001 From: Edoardo Lolletti Date: Thu, 7 Mar 2024 19:57:11 +0100 Subject: [PATCH] Don't narrow --- duel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/duel.cpp b/duel.cpp index a30b87c3..27361334 100644 --- a/duel.cpp +++ b/duel.cpp @@ -133,9 +133,9 @@ void duel::set_response(const void* resp, size_t len) { int32_t duel::get_next_integer(int32_t l, int32_t h) { const uint32_t range = h - l + 1; const uint32_t lim = random.max() % range; - uint32_t n; + uint64_t n; do { - n = static_cast(random()); + n = random(); } while(n <= lim); return static_cast(n % range) + l; }