From d4a58b5fe538e21c003a9f768a12a7a29b1c377d Mon Sep 17 00:00:00 2001 From: Flagg <97263107+Flaggx1@users.noreply.github.com> Date: Fri, 19 May 2023 23:44:32 -0400 Subject: [PATCH] Fix get_random_num function to be inclusive of max parameter The get_random_num function does not currently include the max parameter. This causes issues such as the tilde character not being generated with random rule generation. This makes the max parameter value inclusive. --- src/shared.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared.c b/src/shared.c index ddfc35848..e301523da 100644 --- a/src/shared.c +++ b/src/shared.c @@ -622,11 +622,11 @@ u32 get_random_num (const u32 min, const u32 max) #if defined (_WIN) - return (((u32) rand () % (max - min)) + min); + return (((u32) rand () % (max - min + 1)) + min); #else - return (((u32) random () % (max - min)) + min); + return (((u32) random () % (max - min + 1)) + min); #endif }