TurnRand Method

See Also Applies To Example Model

Turns by a randomly selected angle.

object expression.TurnRand ([LeftLimit], [RightLimit])

object expression    Required. An object expression that evaluates to an object in the Applies To list.

LeftLimit    Optional Double. Left or lower bound for the randomly selected value (in degrees), measured from the Bot's current direction. Defaults to -180 degrees.

RightLimit    Optional Double. Right or upper bound for the randomly selected value (in degrees), measured from the Bot's current direction. Defaults to +180 degrees.

Remarks

After the TurnRand method is executed, the Bot object's Dir property is incremented by selected angle.

Example

The following example uses the TurnRand method to randomly move Bot objects.

Bots.TurnRand -15, 15 
Bots.Step 1