From 567a877b36f90a2807ca18416cc5a15fdadb306a Mon Sep 17 00:00:00 2001 From: CiscOH Bellic Date: Sat, 27 Jul 2024 10:00:12 -0400 Subject: [PATCH] "Added default value for 'divisor' parameter in RandomNumberGenerator function and simplified return statement." --- scripts/Libraries/Math.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/Libraries/Math.lua b/scripts/Libraries/Math.lua index 01e4ef1..dbdba4d 100644 --- a/scripts/Libraries/Math.lua +++ b/scripts/Libraries/Math.lua @@ -90,6 +90,7 @@ Bastion:RegisterLibrary(Bastion.Library:New({ ---@return number function Math.RandomNumberGenerator(lowRange, highRange, divisor) local lowNum, highNum + divisor = divisor or 1 if not highRange then highNum = lowRange lowNum = 1 @@ -111,10 +112,7 @@ Bastion:RegisterLibrary(Bastion.Library:New({ for i = 1, 10 do rtnVal = math.random(#choices) -- iterate a few times for random randomness end - if divisor then - return choices[rtnVal] / divisor - end - return choices[rtnVal] + return choices[rtnVal] / divisor end return Math