MIST random

From DCS World Wiki - Hoggitworld.com


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, isTerrainValid, terrainHeightDiff, getUnitsInZones, getUnitsInMovingZones, pointInPolygon, getUnitsInPolygon, getDeadMapObjsInZones, getDeadMapObjsInPolygonZone, getUnitsLOS, random, randomizeNumTable, stringMatch, getAvgPoint, getQFE

Scripting Engine

MIST Root Page