Methods
(static) normalize(arr) → {Array.<Number>}
- Source:
Normalize / scale an array between 0 and 1.
Parameters:
Name | Type | Description |
---|---|---|
arr |
Array.<Number> | An array. |
Returns:
The normalized / scaled array.
- Type
- Array.<Number>
(static) randomNormal() → {Number}
- Source:
Returns a normally distributed (pseudo) random number.
Returns:
A normally distributed (pseudo) random number.
- Type
- Number
(static) randomNormalInRange(a, b) → {Number}
- Source:
Returns a normally distributed (pseudo) random number within a range.
Parameters:
Name | Type | Description |
---|---|---|
a |
Number | The start of the range. |
b |
Number | The end of the range. |
Returns:
A normally distributed (pseudo) random number within a range.
- Type
- Number
(static) randomNormalScaled(mean, sd) → {Number}
- Source:
Returns a normally distributed (pseudo) random number around a mean with a standard deviation.
Parameters:
Name | Type | Description |
---|---|---|
mean |
Number | The mean. |
sd |
Number | The standard deviation. |
Returns:
A normally distributed (pseudo) random number around a mean with a standard deviation.
- Type
- Number
(static) scale(value, oldMin, oldMax, newMin, newMax) → {Number}
- Source:
Scales a number to within a given scale.
Parameters:
Name | Type | Description |
---|---|---|
value |
Number | The number. |
oldMin |
Number | The current minimum. |
oldMax |
Number | The current maximum. |
newMin |
Number | The cnew minimum. |
newMax |
Number | The new maximum. |
Returns:
The scaled number.
- Type
- Number