Real Method

See Also Applies To Example Model

Returns a random number drawn from a Uniform distribution.

object expression.Real ([Low], [High])

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

Low    Optional Double. The lower bounds of the distribution. Defaults to 0.

High    Optional Double. The upper bounds of the distribution. Defaults to 1.

Remarks

The Real method draws randomly from a Uniform distribution.

Example

The following example turns a Bot object by a random angle generated from a uniform distribution. The uniform distribution has a low bound of -15 and a high bound of 15.

Bot.Turn World.Random.Real(-15, 15)

The following example uses the Real method for assigning a random value drawn from a Uniform distribution to a CellTag.

Cell.Tags("health").Value = World.Random.Real(-1.,1.)