DIFF

Math library

Classes

Functions

private void ~Math()
proto static float AbsFloat(float f)Returns absolute valuemore…
proto static int AbsInt(int i)Returns absolute valuemore…
proto static float Acos(float c)Returns angle in radians from cosinusmore…
proto static float AreaOfRightTriangle(float s, float a)Returns area of a right trianglemore…
proto static float Asin(float s)Returns angle in radians from sinusmore…
proto static float Atan(float x)Returns angle in radians from tangentmore…
proto static float Atan2(float y, float x)Returns angle in radians from tangentmore…
proto static float Ceil(float f)Returns ceil of valuemore…
static vector CenterOfRectangle(vector min, vector max)more…
proto static float Clamp(float value, float min, float max)Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'more…
proto static float Cos(float angle)Returns cosinus of angle in radiansmore…
proto static float DiffAngle(float angle1, float angle2)Return relative difference between anglesmore…
static int Factorial(int val)values above '12' will cause int overflowmore…
proto static float Floor(float f)Returns floor of valuemore…
proto static int GetNthBitSet(int value, int n)returns the the index of n-th bit set in a bit mask counting from the right, for instance, in a mask ..0110 1000 , the 0th set bit(right-most bit set to 1) is at 3th position(starting at 0), 1st bit is at 5th position, 2nd bit is at 6th position etc..
proto static int GetNumberOfSetBits(int i)returns the number of bits set in a bitmask i
proto static float HypotenuseOfRightTriangle(float s, float a)Returns hypotenus of a right trianglemore…
proto static float InverseLerp(float a, float b, float value)Calculates the linear value that produces the interpolant value within the range [a, b], it's an inverse of Lerp.more…
proto static bool IsInRange(float v, float min, float max)Returns if value is between min and max (inclusive)more…
proto static bool IsInRangeInt(int v, int min, int max)Returns if value is between min and max (inclusive)more…
proto static bool IsPointInCircle(vector c, float r, vector p)Returns if point is inside circlemore…
proto static bool IsPointInRectangle(vector mi, vector ma, vector p)Returns if point is inside rectanglemore…
proto static float Lerp(float a, float b, float time)Linearly interpolates between 'a' and 'b' given 'time'.more…
proto static float Log2(float x)Returns the binary (base-2) logarithm of x.more…
private void Math()
proto static float Max(float x, float y)Returns bigger of two given valuesmore…
proto static float Min(float x, float y)Returns smaller of two given valuesmore…
proto static float ModFloat(float x, float y)Returns the floating-point remainder of x/y rounded towards zeromore…
proto static float NormalizeAngle(float ang)Normalizes the angle (0...360)more…
static float Poisson(float mean, int occurences)occurences values above '12' will cause Factorial to overflow int.more…
proto static float Pow(float v, float power)Return power of v ^ powermore…
static bool RandomBool()Returns a random bool .more…
proto static float RandomFloat(float min, float max)Returns a random float number between and min[inclusive] and max[exclusive].more…
static float RandomFloat01()Returns a random float number between and min [inclusive] and max [inclusive].more…
static float RandomFloatInclusive(float min, float max)Returns a random float number between and min [inclusive] and max [inclusive].more…
proto static int RandomInt(int min, int max)Returns a random int number between and min [inclusive] and max [exclusive].more…
static int RandomIntInclusive(int min, int max)Returns a random int number between and min [inclusive] and max [inclusive].more…
proto static int Randomize(int seed)Sets the seed for the random number generator.more…
proto static float RemainderFloat(float x, float y)Returns the floating-point remainder of x/y rounded to nearestmore…
static float Remap(float inputMin, float inputMax, float outputMin, float outputMax, float inputValue, bool clampedOutput = true)Returns given value remaped from input range into output rangemore…
proto static float Round(float f)Returns mathematical round of valuemore…
proto static float SignFloat(float f)Returns sign of given valuemore…
proto static int SignInt(int i)Returns sign of given valuemore…
proto static float Sin(float angle)Returns sinus of angle in radiansmore…
proto static float SmoothCD(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)Does the CD smoothing function - easy in | easy out / S shaped smoothingmore…
static float SmoothCDPI2PI(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)more…
proto static float SqrFloat(float f)Returns squared valuemore…
proto static int SqrInt(int i)Returns squared valuemore…
proto static float Sqrt(float val)Returns square rootmore…
proto static float Tan(float angle)Returns tangent of angle in radiansmore…
static bool VectorIsEqual(vector v1, vector v2, float tolerance)Returns if given vectors are equal with given tolerancemore…
proto static float WrapFloat(float f, float min, float max)Returns wrap number to specified interval [min, max[more…
proto static float WrapFloat0X(float f, float max)Returns wrap number to specified interval [0, max[more…
proto static float WrapFloat0XInclusive(float f, float max)Returns wrap number to specified interval, inclusive [0, max]more…
proto static float WrapFloatInclusive(float f, float min, float max)Returns wrap number to specified interval, inclusive [min, max]more…
proto static int WrapInt(int i, int min, int max)Returns wrap number to specified interval [min, max[more…
proto static int WrapInt0X(int i, int max)Returns wrap number to specified interval [0, max[more…

Variables

static const float DEG2RAD = 0.01745329251994329577
static const float EULER = 2.7182818284590452353
static const float PI = 3.14159265358979
static const float PI_HALF = 1.570796326794
static const float PI2 = 6.28318530717958
static const float RAD2DEG = 57.2957795130823208768

Function Documentation

AbsFloatMath

proto static float AbsFloat(float f)

Returns absolute value

f
float Value

Returns: float - Absolute value

Print( Math.AbsFloat(-12.5) );

>> 12.5



AreaOfRightTriangleMath

proto static float AreaOfRightTriangle(float s, float a)

Returns area of a right triangle

s
float Length of adjacent leg
a
float Angle of corner bordering adjacent which is not the right corner (in radians)

Returns: float - Area


AsinMath

proto static float Asin(float s)

Returns angle in radians from sinus

s
float Sinus

Returns: float - Angle in radians

Print( Math.Asin(0.707107) ); // (sinus 45)

>> 0.785398

AtanMath

proto static float Atan(float x)

Returns angle in radians from tangent

x
float Tangent

Returns: float - Angle in radians


Atan2Math

proto static float Atan2(float y, float x)

Returns angle in radians from tangent

y
float Tangent
x
float Tangent

Returns: float - Angle in radians

Print ( Math.Atan2(1, 1) );

>> 0.785398


CenterOfRectangleMath

static vector CenterOfRectangle(vector min, vector max)
References Vector()

ClampMath

proto static float Clamp(float value, float min, float max)

Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'

value
float Value
min
float Minimum value
max
float Maximum value

Returns: float - Clamped value

Print( Math.Clamp(-0.1, 0, 1) );
Print( Math.Clamp(2, 0, 1) );
Print( Math.Clamp(0.5, 0, 1) );

>> 0
>> 1
>> 0.5


DiffAngleMath

proto static float DiffAngle(float angle1, float angle2)

Return relative difference between angles

angle1
float
angle2
float

Returns: float Difference between angles (angle1 - angle2)

Print( Math.DiffAngle(-45, 45) );
Print( Math.DiffAngle(90, 80) );

>> -90
>> 10

FactorialMath

static int Factorial(int val)

values above '12' will cause int overflow

References ErrorEx()
Referenced by Poisson()


HypotenuseOfRightTriangleMath

proto static float HypotenuseOfRightTriangle(float s, float a)

Returns hypotenus of a right triangle

s
float Length of adjacent leg
a
float Angle of corner bordering adjacent which is not the right corner (in radians)

Returns: float - hypotenus


InverseLerpMath

proto static float InverseLerp(float a, float b, float value)

Calculates the linear value that produces the interpolant value within the range [a, b], it's an inverse of Lerp.

a
float Start
b
float End
value
float value

Returns: float - the time given the position between 'a' and 'b' given 'value', there is no clamp on 'value', to stay between [0..1] use 'value' between 'a' and 'b'

Print( Math.InverseLerp(3, 7, 5) );

>> 0.5

IsInRangeMath

proto static bool IsInRange(float v, float min, float max)

Returns if value is between min and max (inclusive)

v
float Value
min
float Minimum value
max
float Maximum value

Returns: bool - if value is within range [min,max]

Print( Math.IsInRange(6.9, 3.6, 9.3) );

>> true

IsInRangeIntMath

proto static bool IsInRangeInt(int v, int min, int max)

Returns if value is between min and max (inclusive)

v
int Value
min
int Minimum value
max
int Maximum value

Returns: bool - if value is within range [min,max]

Print( Math.IsInRangeInt(6, 3, 9) );

>> true

IsPointInCircleMath

proto static bool IsPointInCircle(vector c, float r, vector p)

Returns if point is inside circle

c
vector Center of circle ([0] and [2] will be used, as a circle is 2D)
r
float Radius of circle
p
vector Point ([0] and [2] will be used, as a circle is 2D)

Returns: bool - True when point is in circle


IsPointInRectangleMath

proto static bool IsPointInRectangle(vector mi, vector ma, vector p)

Returns if point is inside rectangle

mi
vector Minimums of rectangle ([0] and [2] will be used, as a rectangle is 2D)
ma
vector Maximums of rectangle ([0] and [2] will be used, as a rectangle is 2D)
p
vector Point ([0] and [2] will be used, as a rectangle is 2D)

Returns: bool - True when point is in rectangle


LerpMath

proto static float Lerp(float a, float b, float time)

Linearly interpolates between 'a' and 'b' given 'time'.

a
float Start
b
float End
time
float Time [value needs to be between 0..1 for correct results, no auto clamp applied]

Returns: float - The interpolated result between the two float values.

Print( Math.Lerp(3, 7, 0.5) );

>> 5

Log2Math

proto static float Log2(float x)

Returns the binary (base-2) logarithm of x.

x
float Value whose logarithm is calculated.

Returns: float The binary logarithm of x: log2x.
If x is negative, it causes a domain error:
If x is zero, it may cause a pole error (depending on the library implementation).

Print( Math.Log2(1.0) );

>> 0.0

MaxMath

proto static float Max(float x, float y)

Returns bigger of two given values

x
float Value
y
float Value

Returns: float - max value

Print( Math.Max(5.3, 2.8) );

>> 5.3

MinMath

proto static float Min(float x, float y)

Returns smaller of two given values

x
float Value
y
float Value

Returns: float - min value

Print( Math.Min(5.3, 2.8) );

>> 2.8

ModFloatMath

proto static float ModFloat(float x, float y)

Returns the floating-point remainder of x/y rounded towards zero

x
float Value of the quotient numerator
y
float Value of the quotient denominator

Returns: float - The remainder of dividing the arguments

Print( Math.ModFloat(5.3, 2) );
Print( Math.ModFloat(18.5, 4.2) );

>> 1.3
>> 1.7

NormalizeAngleMath

proto static float NormalizeAngle(float ang)

Normalizes the angle (0...360)

ang
float Angle for normalizing

Returns: float - Normalized angle

Print( Math.NormalizeAngle(390) );
Print( Math.NormalizeAngle(-90) );

>> 30
>> 270

PoissonMath

static float Poisson(float mean, int occurences)

occurences values above '12' will cause Factorial to overflow int.

References Factorial(), Pow(), and EULER


RandomBoolMath

static bool RandomBool()

Returns a random bool .

Returns: bool - Random bool either 0 or 1

Print( Math.RandomBool() );
Print( Math.RandomBool() );
Print( Math.RandomBool() );

>> true
>> true
>> false

RandomFloatMath

proto static float RandomFloat(float min, float max)

Returns a random float number between and min[inclusive] and max[exclusive].

min
float Range starts [inclusive]
max
float Range ends [exclusive]

Returns: float - Random number in range

Print( Math.RandomFloat(0,1) );
Print( Math.RandomFloat(0,2) );

>> 0.597561
>> 1.936456
Referenced by ActionPushCarCB.ApplyForce(), ActionSkinning.CreateOrgan(), ActionWringClothes.OnFinishProgressServer()
Show 47 more, Apple.EEOnCECreate(), BBMaterials_Preset.OnPresetSpawn(), BoatScript.EEOnCECreate(), BrainDiseaseMdfr.OnTick(), CameraShake.Update(), Canteen.EEOnCECreate(), CarRadiator.EEKilled(), CarScript.EEOnCECreate(), CarScript.EOnPostSimulate(), ChernarusPlusData.Init(), CutOutSeeds.Do(), DayZGame.CloseCombatEffects(), DeCraftWoodenCrate.Do(), DeveloperTeleport.SetPlayerPosition(), EffBulletImpactBase.CalculateStoppingForce(), EnochData.Init(), FeverBlurSymptom.OnUpdateClient(), FlammableBase.StandUp(), GameInventory.SetGroundPosByOwnerBounds(), GeyserTrigger.RandomizeMouthPos(), GreenBellPepper.EEOnCECreate(), Grenade_Base.ActivateRandomTime(), Hit_MeatBones.BloodSplatGround(), ItemBase.ExplodeAmmo(), KuruShake.KuruShake(), LightDimming.AdvanceState(), MiscEffects.PlayVegetationCollideParticles(), MiscGameplayFunctions.ThrowAllItemsInInventory(), Particle.RandomizeOrientation(), Particle.SetWiggle(), ParticleSource.RandomizeOrientation(), Pear.EEOnCECreate(), PlayerBase.DropItem(), Plum.EEOnCECreate(), Potato.EEOnCECreate(), Raycaster.DoMeasurement(), SakhalData.Init(), SakhalData.WeatherOnBeforeChange(), ScriptedLightBase.HandleDancingShadows(), ScriptedLightBase.HandleFlickering(), StaminaHandler.DepleteStaminaEx(), Tomato.EEOnCECreate(), UnderObjectDecalSpawnComponent.SpawnDecal(), Update117_Preset.OnPresetSpawn(), Update118_Preset.OnPresetSpawn(), WaterBottle.EEOnCECreate(), and Zucchini.EEOnCECreate()


RandomFloatInclusiveMath

static float RandomFloatInclusive(float min, float max)

Returns a random float number between and min [inclusive] and max [inclusive].

min
float Range starts [inclusive]
max
float Range ends [inclusive]

Returns: float - Random number in range

Print( Math.RandomFloatInclusive(0, 1) );	// 0.0 .. 1.0
Print( Math.RandomFloatInclusive(1, 2) );	// 1.0 .. 2.0

>> 0.3
>> 2.0
References Pow(), and RandomInt()

RandomIntMath

proto static int RandomInt(int min, int max)

Returns a random int number between and min [inclusive] and max [exclusive].

min
int Range starts [inclusive]
max
int Range ends [exclusive]

Returns: int - Random number in range

Print( Math.RandomInt(0, 1) );	// only 0
Print( Math.RandomInt(0, 2) );	// 0 or 1

>> 0
>> 1

RandomIntInclusiveMath

static int RandomIntInclusive(int min, int max)

Returns a random int number between and min [inclusive] and max [inclusive].

min
int Range starts [inclusive]
max
int Range ends [inclusive]

Returns: int - Random number in range

Print( Math.RandomIntInclusive(0, 1) );	// 0 or 1
Print( Math.RandomIntInclusive(0, 2) );	// 0, 1, 2

>> 1
>> 2
References RandomInt()
Referenced by ActionDisarmExplosive.OnFinishProgressServer(), ActionDisarmMine.OnFinishProgressServer(), ActionPackGift.OnFinishProgressServer()
Show 47 more, AreaDamageBase.GetRaycastedHitZone(), AreaDamageComponentRaycasted.GetFallbackHitZone(), AreaExposureMdfr.BleedingSourceCreateCheck(), BearTrap.OnServerSteppedOn(), CAContinuousMineWood.DamagePlayersHands(), CarScript.OnVehicleJumpOutServer(), ChernarusPlusData.CalculateVolFog(), ChernarusPlusData.CalculateWind(), ChernarusPlusData.WeatherOnBeforeChange(), CholeraMdfr.OnActivate(), CholeraMdfr.OnTick(), CraftBaseBallBatBarbed.Do(), DayZPlayerImplementFallDamage.Randomize(), DayZPlayerMeleeFightLogic_LightHeavy.DamageHands(), DeCraftWoodenCrate.Do(), Edible_Base.ProcessDecay(), EmoteVomit.EmoteStartOverride(), EnochData.CalculateVolFog(), EnochData.CalculateWind(), EnochData.WeatherOnBeforeChange(), FireworksLauncher.FireworksLauncher(), FireworksLauncherClientEvent.GetSecondaryExplosionDelay(), HitDirectionEffectBase.Init(), HitDirectionEffectSplash.SetIndicatorRotation(), HitDirectionImagesBase.RandomizeImageIdx(), HotSpringTrigger.SpawnVaporEffect(), LandMineTrap.OnSteppedOn(), MapNavigationBehaviour.RandomizedDeviation(), RandomBool(), MiscGameplayFunctions.GetRandomizedPosition(), MissionServer.RandomArtillery(), OpenItem.OpenAndSwitch(), PrepareChicken.Do(), PrepareFox.Do(), PrepareRabbit.Do(), SakhalData.CalculateWind(), SakhalData.WeatherOnBeforeChange(), SpookyTriggerEventsHandler.SelectEvent(), ToxicityMdfr.OnTick(), UiHintPanel.RandomizePageIndex(), VolcanicTrigger.SpawnVaporEffect(), Weapon_Base.FillChamber(), Weapon_Base.FillInnerMagazine(), Weapon_Base.SpawnAttachedMagazine(), Wreck_SantasSleigh.RandomizePosition(), Wreck_SantasSleigh.SpawnRandomDeers(), and ZombieBase.HandleDamageHit()

RandomizeMath

proto static int Randomize(int seed)

Sets the seed for the random number generator.

seed
int New seed for the random number generator, -1 will use time

Returns: int - Returns new seed

Print( Math.Randomize(5) );

>> 5

RemainderFloatMath

proto static float RemainderFloat(float x, float y)

Returns the floating-point remainder of x/y rounded to nearest

x
float Value of the quotient numerator
y
float Value of the quotient denominator

Returns: float - The remainder of dividing the arguments

Print( Math.RemainderFloat(5.3, 2) );
Print( Math.RemainderFloat(18.5, 4.2) );

>> -0.7
>> 1.7

RemapMath

static float Remap(float inputMin, float inputMax, float outputMin, float outputMax, float inputValue, bool clampedOutput = true)

Returns given value remaped from input range into output range

inputMin
float Minimal value of given input range
inputMax
float Maximal value of given input range
outputMin
float Minimal value of given output range
outputMax
float Maximal value of given output range
inputValue
float Value we want to remap
clampedOutput
bool If value should stay in that range, otherwise it will be extrapolated

Returns: float - Remapped value

References Clamp(), InverseLerp(), and Lerp()

RoundMath

proto static float Round(float f)

Returns mathematical round of value

f
float Value

Returns: float - closest whole number to 'f'

Print( Math.Round(5.3) );
Print( Math.Round(5.8) );

>> 5
>> 6

SignFloatMath

proto static float SignFloat(float f)

Returns sign of given value

f
float Value

Returns: float - Sign of given value

Print( Math.SignFloat(-12.0) );
Print( Math.SignFloat(0.0) );
Print( Math.SignFloat(12.0) );

>> -1.0
>> 0
>> 1.0

SignIntMath

proto static int SignInt(int i)

Returns sign of given value

i
int Value

Returns: int - Sign of given value

Print( Math.SignInt(-12) );
Print( Math.SignInt(0) );
Print( Math.SignInt(12) );

>> -1
>> 0
>> 1

SinMath

proto static float Sin(float angle)

Returns sinus of angle in radians

angle
float Angle in radians

Returns: float - Sinus of angle

Print( Math.Sin(0.785398) ); // (45)

>> 0.707107
Referenced by ActionTargets.DrawDebugCone(), AnimatorTimer.Tick(), BaseBuildingBase.CalcDamageAreaRotation()
Show 36 more, BleedingIndicatorDropData.ScatterPosition(), DayZPlayerCameraIronsights.OnUpdate(), DayZPlayerImplementAiming.ApplyBreathingPattern(), Debug.DrawCone(), Easing.EaseInElastic(), Easing.EaseInOutElastic(), Easing.EaseOutElastic(), Easing.EaseOutSine(), EffectArea.FillWithParticles(), EffectArea.PlaceParticles(), EntityPlacementCallback.OnSetup(), FeverBlurSymptom.OnUpdateClient(), FireplaceBase.OnAttachmentRuined(), FlareSimulation.FlareParticleUpdate(), HitDirectionEffectArrow.FinalizePositionCalculation(), HitDirectionEffectBase.CalculateArrowPosition(), HitDirectionEffectSpike.FinalizePositionCalculation(), MiscGameplayFunctions.Bobbing(), MiscGameplayFunctions.DropAllItemsInInventoryInBounds(), MiscGameplayFunctions.FilterObstructedObjectsByGrouping(), MiscGameplayFunctions.GetHeadingVector(), MiscGameplayFunctions.GetRandomizedPosition(), PartyLight.OnFrameLightSource(), PlayerBase.OnUnconsciousUpdate(), PPERequester_Drowning.OnUpdate(), PPERequester_HeavyMetalPoisoning_3.SetEffectProgress(), PPERequester_HMPGhosts.ProcessSimulation(), PPERequester_HMPGhosts.ReSampleChannels(), PPERequester_HMPGhosts.SampleChannels(), RadialMenu.Refresh(), ScriptedLightBase.HandleBlinking(), vector.RotateAroundZeroDeg(), vector.RotateAroundZeroRad(), VicinityItemManager.DebugConeDraw(), VicinityItemManager.RefreshVicinityItems(), and ZombieBase.HandleOrientation()

SmoothCDMath

proto static float SmoothCD(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)

Does the CD smoothing function - easy in | easy out / S shaped smoothing

val
actual value
target
value we are reaching for -> Target
velocity
float[1] - array of ONE member - some kind of memory and actual accel/decel rate, need to be zeroed when filter is about to be reset
smoothTime
smoothing parameter, 0.1 .. 0.4 are resonable values, 0.1 is sharp, 0.4 is very smooth
maxVelocity
maximal value change when multiplied by dt
dt
delta time

Returns: float smoothed/filtered value

val = EnfMath.SmoothCD(val, varTarget, valVelocity, 0.3, 1000, dt);

SmoothCDPI2PIMath

static float SmoothCDPI2PI(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)
References SmoothCD(), PI, and PI2


SqrIntMath

proto static int SqrInt(int i)

Returns squared value

i
int Value

Returns: int - Squared value

Print( Math.SqrInt(12) );

>> 144

SqrtMath

proto static float Sqrt(float val)

Returns square root

val
float Value

Returns: float - Square of value

Print( Math.Sqrt(25));

>> 5

TanMath

proto static float Tan(float angle)

Returns tangent of angle in radians

angle
float Angle in radians

Returns: float - Tangens of angle

Print( Math.Tan(0.785398) ); // (45)

>> 1

VectorIsEqualMath

static bool VectorIsEqual(vector v1, vector v2, float tolerance)

Returns if given vectors are equal with given tolerance

v1
float First vector for comparison
v2
float Second vector for comparison
tolerance
float Range in which given vectors can differ

Returns: bool - True if Vectors are equal; otherwise false

References AbsFloat()

WrapFloatMath

proto static float WrapFloat(float f, float min, float max)

Returns wrap number to specified interval [min, max[

f
float Value
min
float Minimum
max
float Maximum

Returns: float - number in specified interval [min, max[

Print( Math.WrapFloat(9.0, 1.0, 9.0) );

>> 1.0

WrapFloat0XMath

proto static float WrapFloat0X(float f, float max)

Returns wrap number to specified interval [0, max[

f
float Value
max
float Maximum

Returns: float - number in specified interval [0, max[

Print( Math.WrapFloat0X(9.0, 9.0) );

>> 0.0

WrapFloat0XInclusiveMath

proto static float WrapFloat0XInclusive(float f, float max)

Returns wrap number to specified interval, inclusive [0, max]

f
float Value
max
float Maximum

Returns: float - number in specified interval [0, max]

Print( Math.WrapFloat0XInclusive(9.0, 9.0) );

>> 9.0

WrapFloatInclusiveMath

proto static float WrapFloatInclusive(float f, float min, float max)

Returns wrap number to specified interval, inclusive [min, max]

f
float Value
min
float Minimum
max
float Maximum

Returns: float - number in specified interval [min, max]

Print( Math.WrapFloatInclusive(9.0, 1.0, 9.0) );

>> 9.0

WrapIntMath

proto static int WrapInt(int i, int min, int max)

Returns wrap number to specified interval [min, max[

i
int Value
min
float Minimum
max
int Maximum

Returns: int - number in specified interval [min, max[

Print( Math.WrapInt(9, 1, 9) );

>> 1

WrapInt0XMath

proto static int WrapInt0X(int i, int max)

Returns wrap number to specified interval [0, max[

i
int Value
max
int Maximum

Returns: int - number in specified interval [0, max[

Print( Math.WrapInt0X(9, 9) );

>> 0