proportionalJitter
Returns a number randomly jittered by a proportion of a base value
84 bytes
since v12.7.0
Usage
Add proportional noise to a base value by scaling a random offset with a given factor.
import * as import _
_ from 'radashi'
const const base: 100
base = 100import _
_.function proportionalJitter(base: number, factor: number): number
Returns a value randomly jittered by a proportion of the base value.
proportionalJitter(const base: 100
base, 0.1) // => a number between 90 and 110Basically, the example above is saying “add 10% noise to the base value”, in either direction (plus or minus).