Jump to content

GetRandomHeading

From CMM Wiki
Revision as of 10:12, 11 November 2025 by Ozdeadmeat (talk | contribs) (GetRandomHeading – created via PowerShell script (2025-11-11T21:12:35Z))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Return to CMM Command Reference
Environment: Mission Scripting
Function: GetRandomHeading
Function Description: Generates a random heading within a specified direction arc, supporting wraparound for arcs that span beyond 360 degrees.
File Location: cmm.positionFunctions.lua
Syntax: CMM.GetRandomHeading( number dir1 , number dir2 )
Return Value: number
Parameters: Name Description
dir1Left boundary of the direction arc in degrees, defaults to 0 if not provided.
dir2Right boundary of the direction arc in degrees, defaults to 359 if not provided.
Example: CMM.GetRandomHeading(90, 180)
Example Description: Returns a random heading between 90 and 180 degrees, suitable for randomizing unit orientation within a northern-hemisphere arc.
Related Functions:
Notes: