From 84712c513acc1e0af070943d7de7d98b8614175c Mon Sep 17 00:00:00 2001 From: Hagen Rothe <100077753+HagenRo@users.noreply.github.com> Date: Sat, 26 Feb 2022 20:39:20 +0100 Subject: [PATCH 1/2] Update scriptInterface.cpp tried to make it mathematically correct --- src/scriptInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scriptInterface.cpp b/src/scriptInterface.cpp index e6f5606e..65a0d2ef 100644 --- a/src/scriptInterface.cpp +++ b/src/scriptInterface.cpp @@ -13,7 +13,7 @@ static int random(lua_State* L) return 1; } /// random(min_value, max_value) -/// Generate a random floating point number between the min and max value. Includes min and max as possible values. +/// Generate a random floating point number uniformly distributed on the interval [min_value, max_value). Meaning min_value included and max_value excluded. /// (Floating point numbers are factional numbers, so 1.5, 2.333333, 3.141) REGISTER_SCRIPT_FUNCTION(random); @@ -26,7 +26,7 @@ static int irandom(lua_State* L) return 1; } /// irandom(min_value, max_value) -/// Generate a random integer number between the min and max value. Includes min and max as possible values. +/// Generate a random integer number uniformly distributed on the interval [min_value, max_value]. Meaning min_value and max_value included. /// (Integer numbers are whole numbers, so 1, 2, 3, 5, 1400) REGISTER_SCRIPT_FUNCTION(irandom); From af4593af1b10052119208fe04cdc5031ad515b7a Mon Sep 17 00:00:00 2001 From: Hagen Rothe <100077753+HagenRo@users.noreply.github.com> Date: Sun, 27 Feb 2022 16:48:58 +0100 Subject: [PATCH 2/2] Update scriptInterface.cpp changed it to closed intervall and added the reference link for further information --- src/scriptInterface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scriptInterface.cpp b/src/scriptInterface.cpp index 65a0d2ef..4438e2a5 100644 --- a/src/scriptInterface.cpp +++ b/src/scriptInterface.cpp @@ -13,7 +13,8 @@ static int random(lua_State* L) return 1; } /// random(min_value, max_value) -/// Generate a random floating point number uniformly distributed on the interval [min_value, max_value). Meaning min_value included and max_value excluded. +/// Generate a random floating point number uniformly distributed on the interval [min_value, max_value]. Meaning min_value and max_value included. +/// For further information see: https://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution. /// (Floating point numbers are factional numbers, so 1.5, 2.333333, 3.141) REGISTER_SCRIPT_FUNCTION(random);