Random global functions
- Source
Methods
(static) rand(valueAopt, valueBopt) → {Number}
Returns a random value between the two values passed in
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
valueA | Number | <optional> | 1 | |
valueB | Number | <optional> | 0 |
- Source
Returns:
- Type:
- Number
(static) randColor(colorAopt, colorBopt, linearopt) → {Color}
Returns a random color between the two passed in colors, combine components if linear
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
colorA | Color | <optional> | (1,1,1,1) | |
colorB | Color | <optional> | (0,0,0,1) | |
linear | Boolean | <optional> | false |
- Source
Returns:
- Type:
- Color
(static) randInCircle(radiusopt, minRadiusopt) → {Vector2}
Returns a random Vector2 within a circular shape
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
radius | Number | <optional> | 1 | |
minRadius | Number | <optional> | 0 |
- Source
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:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
valueA | Number | |||
valueB | Number | <optional> | 0 |
- Source
Returns:
- Type:
- Number
(static) randSign() → {Number}
Randomly returns either -1 or 1
- Source
Returns:
- Type:
- Number
(static) randVector(lengthopt) → {Vector2}
Returns a random Vector2 with the passed in length
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
length | Number | <optional> | 1 |
- Source
Returns:
- Type:
- Vector2