function* pachinko(random, extent, height = 200) {
const radius = 2;
const dodge = dodger(radius * 2 + 1);
const margin = {top: 0, right: 30, bottom: 20, left: 30};
const values = Float64Array.from({length: n}, random);
if (extent === undefined) extent = d3.extent(values);
const x = d3.scaleLinear(extent, [margin.left, width - margin.right]).nice();
const svg = d3.select(DOM.svg(width, height)).style("overflow", "visible");
yield svg.node();
svg.append("g")
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(x));
for (let i = 0; i < n; ++i) {
if (i % 20 == 0) yield svg.node();
const cx = x(values[i]);
const cy = height - margin.bottom - dodge(cx) - radius - 1;
if (cy < margin.top) break;
svg.append("circle")
.attr("cx", cx)
.attr("cy", -400)
.attr("r", radius)
.attr("cy", cy);
}
yield svg.node();
}