Skip to content

Commit

Permalink
Refactor rand Command to Use Random Class
Browse files Browse the repository at this point in the history
  • Loading branch information
wilyt1 committed Jul 13, 2024
1 parent 232064c commit 59f7fb9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Cmdr/BuiltInCommands/Utility/rand.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local generator = Random.new()

return {
Name = "rand",
Aliases = {},
Expand All @@ -17,7 +19,11 @@ return {
},
},

ClientRun = function(_, min, max)
return tostring(max and math.random(min, max) or math.random(min))
ClientRun = function(_, firstNumber, secondNumber)
return tostring(
if secondNumber
then generator:NextInteger(firstNumber, secondNumber)
else generator:NextInteger(1, firstNumber)
)
end,
}

0 comments on commit 59f7fb9

Please sign in to comment.