Published
Edited
Jun 23, 2022
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function* haltonSequence(base, max = Infinity) {
let index = 1;
while (index <= max) {
let f = 1;
let r = 0;
let i = index;
while (i > 0) {
f = f / base;
r = r + f * (i % base);
i = Math.floor(i / base);
}
yield r;
index += 1;
}
}
Insert cell
points = {
restart;
let throwAway = xPrime * yPrime;
let xGen = haltonSequence(xPrime, 1000 + throwAway);
let yGen = haltonSequence(yPrime, 1000 + throwAway);

let done = false;
let points = [];
let index = 0;
while (!done) {
let xStep = xGen.next();
let yStep = yGen.next();
done = xStep.done || yStep.done;
if (done) break;
points.push({ x: xStep.value, y: yStep.value, index: index - throwAway });
if (!skipAnimation && points.length > throwAway && index % speed == 0)
yield points.slice(throwAway);
index += 1;
}
yield points;
}
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