Skip to content

Commit

Permalink
Refactor rand Command to Use Random Class (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilyt1 authored Sep 20, 2024
1 parent 0cac041 commit 442f98f
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 442f98f

Please sign in to comment.