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