Skip to content

Commit

Permalink
GetRandomInt
Browse files Browse the repository at this point in the history
  • Loading branch information
KionX authored and shalkya committed Jun 13, 2021
1 parent 1cb5155 commit 968d09e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lua/utilities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ function GetMidPoint(v1, v2)
end

function GetRandomFloat(nmin, nmax)
return (Random() * (nmax - nmin) + nmin)
return Random() * (nmax - nmin) + nmin
end

function GetRandomInt(nmin, nmax)
return math.floor(Random() * (nmax - nmin + 1) + nmin)
return Random(nmin, nmax)
end

function GetRandomOffset(sx, sy, sz, scalar)
Expand All @@ -176,9 +176,9 @@ function GetRandomOffset2(sx, sy, sz, scalar)
sx = sx * scalar
sy = sy * scalar
sz = sz * scalar
local x = Random(-1.0, 1.0) * sx - (sx * 0.5)
local y = Random(-1.0, 1.0) * sy
local z = Random(-1.0, 1.0) * sz - (sz * 0.5)
local x = (Random() * 2 - 1) * sx - (sx * 0.5)
local y = (Random() * 2 - 1) * sy
local z = (Random() * 2 - 1) * sz - (sz * 0.5)

return x, y, z
end
Expand Down

0 comments on commit 968d09e

Please sign in to comment.