A_RandomState is an action that randomly chooses between two states to use as the next state. Var1 and Var2 specify the states to choose from.
Code – A_RandomState
// Function: A_RandomState
// Description: Chooses one of the two state numbers supplied randomly.
// var1 = state number 1
// var2 = state number 2
void A_RandomState(mobj_t *actor)
INT32 locvar1 = var1;
INT32 locvar2 = var2;
if (LUA_CallAction("A_RandomState", actor))
P_SetMobjState(actor, P_RandomChance(FRACUNIT/2) ? locvar1 : locvar2);