Random

Random global functions

Methods

(static) rand(valueAopt, valueBopt) → {number}

Returns a random value between the two values passed in

Parameters:
NameTypeAttributesDefaultDescription
valueAnumber<optional>
1
valueBnumber<optional>
0
Returns:
Type: 
number

(static) randColor(colorAopt, colorBopt, linearopt) → {Color}

Returns a random color between the two passed in colors, combine components if linear

Parameters:
NameTypeAttributesDefaultDescription
colorAColor<optional>
(1,1,1,1)
colorBColor<optional>
(0,0,0,1)
linearboolean<optional>
false
Returns:
Type: 
Color

(static) randInCircle(radiusopt, minRadiusopt) → {Vector2}

Returns a random Vector2 within a circular shape

Parameters:
NameTypeAttributesDefaultDescription
radiusnumber<optional>
1
minRadiusnumber<optional>
0
Returns:
Type: 
Vector2

(static) randInt(valueA, valueBopt) → {number}

Returns a floored random value between the two values passed in The upper bound is exclusive. (If 2 is passed in, result will be 0 or 1)

Parameters:
NameTypeAttributesDefaultDescription
valueAnumber
valueBnumber<optional>
0
Returns:
Type: 
number

(static) randSign() → {number}

Randomly returns either -1 or 1

Returns:
Type: 
number

(static) randVector(lengthopt) → {Vector2}

Returns a random Vector2 with the passed in length

Parameters:
NameTypeAttributesDefaultDescription
lengthnumber<optional>
1
Returns:
Type: 
Vector2