Quick actions

cmd+k|ctrl+k

Navigation

Languages

math2 module v1.5

Snippet info

Language

Lua

Visibility

public

Author

codedbytes

Created

2020-07-19T00:32:50Z

Updated

2020-07-19T00:32:50Z

--Made by DevSersponge
_G.math2 = {} 
_G.math2.ceil = function(x)
local y = x%1
local z = x-y
if y > 0 then return z+1 else return z end 
end
_G.math2.floor = function(x)
local y = x%1
local z = x-y
if y > 0 then return z else return x end 
end
_G.math2.round = function(x)
local y = ((math2.ceil(x))-.5) if x < y then return math2.floor(x) else return math2.ceil(x) end 
end
_G.math2.map = function(val,mini,maxi,mino,maxo)
return(val- mini) *(maxo - mino)/(maxi - mini)+mino
end 
_G.math2.random=function(mi,ma)
local a=tostring(mi)
local b=tostring(ma)
local df1="1"
local df2="1" 
local df3=df1
for i=1,#a do 
df1=(df1..'0')
end 
for i=1,#b do 
df2=(df2..'0')
end 
if tonumber(df1)>tonumber(df2) then df3=df1 else df3=df2 end 
return math.random(tonumber(a)*tonumber(df1),tonumber(b)*tonumber(df2))/df3
end 
_G.math2.solvetri=function(a,b)return(180-a-b)end
_G.math2.solvequad=function(a,b,c)return(360-a-b-c)end 
INFO