MIST random

From DCS World Wiki - Hoggitworld.com
Revision as of 23:09, 13 April 2018 by Grimes (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


mist.random

Added with: Mist 3.3
Description
Returns a random numerical value based on the input variables. Matches input values of the math.random() function except this function does not support decimals.
Syntax
number mist.random(number/number low/high , number high )
Valid Input Values:
number low and high, any round number
Return value:
number
Return example:
any non round number
Usage Examples:
  do
    local randChoice = mist.random(5)
    if randChoice == 1 then
     -- do whatever
    elseif randChoice == 2 then
     -- do whatever2
    elseif randChoice > 2 then
     -- do whatever3
  end
Notes:
If the optional variable is not present then a random number will be returned between 1 and the required variable.

This function has been created to act as a customized replacement of math.random, specifically for any random choice with less than 50 possibilities.

Related Functions
makeUnitTable, getRandPointInCircle, getRandomPointInZone, getRandomPointInPoly, isTerrainValid, terrainHeightDiff, getUnitsInZones, getUnitsInMovingZones, pointInPolygon, getUnitsInPolygon, getDeadMapObjsInZones, getDeadMapObjsInPolygonZone, getUnitsLOS, random, randomizeNumTable, getAvgPoint, getQFE, getWindBearingAndVel, getPathLength, getPathInSegments, getPointAtDistanceOnPath, projectPoint, getGroupsByAttribute, , getUnitsByAttribute, mapValue,

Scripting Engine

MIST Root Page