Methods
(static) nextBoolean(probabilityTrue) → {boolean}
- Source:
Generate a random boolean via fair probability coin toss.
If `probabilityTrue` is supplied, the coin toss is skewed by that value.
Parameters:
Name | Type | Description |
---|---|---|
probabilityTrue |
number | Skewed probability of true. |
Returns:
Result of coin flip skewed toward `probabilityTrue`.
- Type
- boolean
(static) nextColor() → {string}
- Source:
Generate a random hexadecimal color code of the format #RRGGBB.
Returns:
Hexadecimal representation of random color.
- Type
- string
(static) nextFloat(min, max) → {number}
- Source:
Get a random float between low to high, inclusive.
If only one parameter is given, a random float
from (0, low-1) inclusive.
Parameters:
Name | Type | Description |
---|---|---|
min |
number | Lower bound on range of random int. |
max |
number | Upper bound on range of random int. |
Returns:
Random number between low and high, inclusive.
- Type
- number
(static) nextHex() → {string}
- Source:
Generates a random number in range (0,255) in hexadecimal.
Returns:
Random number in hexadecimal form.
- Type
- string
(static) nextInt(min, max) → {number}
- Source:
Get a random integer between low to high, inclusive.
If only one parameter is given, a random integer
from (0, low-1) inclusive.
Parameters:
Name | Type | Description |
---|---|---|
min |
number | Lower bound on range of random int. |
max |
number | Upper bound on range of random int. |
Returns:
Random number between low and high, inclusive.
- Type
- number
(static) noise(x, yopt) → {number}
- Source:
A noise function for generating a smooth, random value between 0 and 1.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x |
number | Any number. Adjacent numbers will have similar noise values, by definition of Perlin noise. | |
y |
number |
<optional> |
Any number. If y is present, 2d will be used. |
Returns:
- Type
- number