function math.IsEvenNumber(num) local num1,num2=math.modf(num/2)--返回整数和小数部分 if(num2==0)then return true else return false end end function math.Clamp(v, max, min) local r = v local r = math.min(max, r) local r = math.max(min, r) return r end function math.GetIntPart(x) if x <= 0 then return math.ceil(x); end if math.ceil(x) == x then x = math.ceil(x); else x = math.ceil(x) - 1; end return x; end ---自定义随机函数 function math.randfunc(seed) local mul = assert(seed) return function(l, h) l = l or 0 h = h or 0x7fffffff mul = mul * 0xefff % 0x7fffffff return l + mul % (h-l+1) end end
LuaMath
最新推荐文章于 2024-01-19 15:08:14 发布