Skip to content

Advanced

Sources of random

You may notice that the jittered value is uniform. It doesn’t seem to ‘stick’ close to the input value, as we might expect of a more organic kind of system.

This is visible in the plot below, where we jitter a value of 0.5, but the resulting values are far and wide:

Instead of using the default random number generator Math.random, we could plug in a weighted , or gaussian random number generator.

import { jitter } from 'https://unpkg.com/ixfx/dist/modulation.js';
import { gaussian } from 'https://unpkg.com/ixfx/dist/random.js';
const jitterFn = jitter({ absolute:0.2, source: gaussian });

The plot below uses a gaussian (ie. bell-curve) distribution of random numbers. Note how the jittered values are clustered closer to the original value (0.5) compared to the earlier plot even though the input value and range is the same.