Phaser API Documentation

  Version: 

Member of: Phaser.Math

<static> RandomXY(vector, [scale])

Description:

Compute a random unit vector.

Computes random values for the given vector between -1 and 1 that can be used to represent a direction.

Optionally accepts a scale value to scale the resulting vector by.

Parameters:

name type arguments Default description
vector Phaser.Math.Vector2

The Vector to compute random values for.

scale number <optional> 1

The scale of the random values.

Returns:
Description:

The given Vector.

Examples:
Since: 3.0.0
Source: src/math/RandomXY.js (Line 7)