Public
Edited
Jul 5, 2023
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
seed = useSeed ? 0.314 : undefined
Insert cell
function makeSimplex1D(seed, smoothness = 20) {
const simplex = new SimplexNoise(seed);
const simplexNoise1D = (n) => simplex.noise2D(n / smoothness, 10);
// use a closure to hide required incrementing parameter
let i = 0;
function noise1D() {
return simplexNoise1D(i++);
}
return noise1D;
}
Insert cell
Insert cell
simplex1D = (smoothness = 20) => {
const source = (seed) => makeSimplex1D(seed, smoothness);
const gen = makeSimplex1D(d3.randomUniform()(), smoothness);
gen.source = source;
return gen;
}
Insert cell
test = simplex1D().source(0.123)
Insert cell
test()
Insert cell
data = {
const f = makeSimplex1D(seed, sx);
return d3.range(n).map((d) => f());
}
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more