Math - MSUTeam/MSU GitHub Wiki
File path: scripts/config/msu/math.nut
::MSU.Math.log2int( _num );
// _num is a float or integerReturns the base 2 logarithm of _num floored as an int.
::MSU.Math.normalDist( _x, _mean, _std )
// _x, _mean and _std are floats or integersReturns the value of the Normal Distribution for _x
for the provided mean value of _mean and standard deviation _std.
::MSU.Math.normalDistNorm( _x, _mean, _std )
// _x, _mean and _std are floats or integersReturns the normalized (divide by maximum) value of the Normal Distribution
for _x for the provided mean value of _mean
and standard deviation _std.
::MSU.Math.randf( _min, _max )
// _min and _max are floatsReturns a random float between _min and _max,
inclusive of both.
::MSU.Math.roundToMult( _num, _multiple )
// _num and _multiplier are integers or floats
// _multiplier cannot be negativeReturns a float which is _num rounded to the nearest multiple of _multiple.
::MSU.Math.roundToSig( _num, _significantFigures )
// _num is an integer or float
// _significantFigures is a positive integerReturns a float which is _num rounded to _significantFigures significant figures.
::MSU.Math.roundToDec( _num, _decimalPlaces )
// _num is an integer or float
// _decimalPlaces is a positive integerReturns a float which is _num rounded to _decimalPlaces decimal places.
::MSU.Math.truncf( _num, _decimalPlaces )
// _num is a float
// _decimalPlaces is a positive integerReturns a float which is _num with any decimal places beyond _decimalPlaces removed.