-
Notifications
You must be signed in to change notification settings - Fork 6
Math
LordMidas edited this page Jul 12, 2024
·
6 revisions
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.
- NOTE: MSU guarantees backwards compatibility for documented features and code only. Undocumented features/code of MSU may be changed at any time without notice, so we advise against using/referencing such code in your projects.
- For bug reports or feature requests, please create issues.
- If you would like to join the team, write to us at msu.team@protonmail.com.