FANDOM


math.floor, math.ceil, math.roundEdit

[number] math.floor( [number] value )
[number] math.ceil( [number] value )
[number] math.round( [number] value )

Returns the specified number respectively rounded down, rounded up or rounded to the nearest integer.

math.clampEdit

[number] math.clamp( [number] value, [number] min, [number] max )

Make sure that value is between min and max. If value is inferior than min or superior than max, it is brought back to the closest boundary.

math.randomrangeEdit

[number] math.randomrange( [number] lower, [number] upper )

Generate a random real number (a float) between lower and upper.

(Until CraftStudio Beta is released) you need to initialize the random number generator by placing the following line anywhere in your code before using math.randomrange() or math.random().

math.randomseed( os.time() )