From 9e865722b26f849c0dcb9eab0b548cfcae29ec92 Mon Sep 17 00:00:00 2001 From: NoahJCross Date: Sun, 5 Jan 2025 19:26:37 +1100 Subject: [PATCH 1/3] Random number generation bug fixes --- civetweb | 1 + coresdk/src/coresdk/random.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 160000 civetweb diff --git a/civetweb b/civetweb new file mode 160000 index 00000000..1909c45d --- /dev/null +++ b/civetweb @@ -0,0 +1 @@ +Subproject commit 1909c45d84f6e674ed5ad678a22630fa470a7dd5 diff --git a/coresdk/src/coresdk/random.cpp b/coresdk/src/coresdk/random.cpp index 8ae17dcf..9aaa5b1c 100644 --- a/coresdk/src/coresdk/random.cpp +++ b/coresdk/src/coresdk/random.cpp @@ -22,9 +22,9 @@ namespace splashkit_lib return rnd(RAND_MAX) / static_cast(RAND_MAX); } - int rnd(int ubound) + int rnd(int ubound) { - if (ubound == 0) return 0; + if (ubound <= 0) return 0; if (_do_seed) { @@ -51,6 +51,7 @@ namespace splashkit_lib srand((unsigned)time(0)); } - return min + rand() % (max - min); + int range = abs(max - min) + 1; + return min + (rand() % range); } } From e0b8b6b88db99afab3530cedcb760b3a30b502b3 Mon Sep 17 00:00:00 2001 From: NoahJCross Date: Mon, 6 Jan 2025 00:54:25 +1100 Subject: [PATCH 2/3] removed civitweb folder --- civetweb | 1 - 1 file changed, 1 deletion(-) delete mode 160000 civetweb diff --git a/civetweb b/civetweb deleted file mode 160000 index 1909c45d..00000000 --- a/civetweb +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1909c45d84f6e674ed5ad678a22630fa470a7dd5 From 885a0b6e7b4d09ba0d726ec5d90ea4a57fd2b85a Mon Sep 17 00:00:00 2001 From: NoahJCross Date: Mon, 6 Jan 2025 01:01:43 +1100 Subject: [PATCH 3/3] Fixed indentation --- coresdk/src/coresdk/random.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coresdk/src/coresdk/random.cpp b/coresdk/src/coresdk/random.cpp index 9aaa5b1c..3334b42d 100644 --- a/coresdk/src/coresdk/random.cpp +++ b/coresdk/src/coresdk/random.cpp @@ -22,7 +22,7 @@ namespace splashkit_lib return rnd(RAND_MAX) / static_cast(RAND_MAX); } - int rnd(int ubound) + int rnd(int ubound) { if (ubound <= 0) return 0;